Dear Friend,

The following coding is used to give your requirement
Code:
use strict;
use warnings;
use Data::Dumper;
my $var;
foreach(@ARGV)
{
opendir(DIR,$_);
my @array=readdir(DIR);
foreach(@array)
{
    $var=$_;
    if($var=~/(\.txt|\.xml)/)
    {
     system("grep -lh 'welcome' $var");
    }
}
}