Im currently learning perl and Im trying to open many text files and read the contents and extract a string from the files and the corresponding file name ...Th snippet im using is
@scriptfiles=glob('*.txt'); foreach my $file (@checkfiles) { open($file, "data.txt") or die("Unable to open file"); # read file into an array @data = <$file>; # close file close($file); foreach my $line(@data) { #print $line; if ($line =~ m/(Apple|Orange|Litchi)/) { $Sheet->Cells($row,$col-1)->{'Value'} = $file; $Sheet-> Cells($row,$col+6)->{'Value'} = $line ; $row=$row+1; }
I cant able to open the file and read the contents..pls rectify my mistake..
In reply to File Open Error by stallion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |