13

Directory Search Perl

view full story
linux-howto

http://www.unix.com – Code: @scriptfiles=glob('*.txt');   foreach $file (glob('*.txt')) {     open(my $fh, $file) or die("Unable to open '$file': $!");      while (my $line = <$fh>)     {         if ($line =~ m/(Apple|Orange|Guava)/i)         {             $Sheet->Cells($row,$col-1)->{'Value'} = $file; The above snippet will open each text file in the current folder and do a match for the words and if its matched the file name will be printed.. How to do the same for the fil (HowTos)