in reply to Using open in for loop
print "$array[$i]\n"; #open(FILE,"$array[$i]") or die "Could not open file :$!"; # do something #close(FILE); [download]
grep
open(FILE,"$_") or die " Could not open file :$! " ; [download]
In addition to everything else that has been said, the oft and rightly so repeated mantra is:
To which I add: "$_" is called "useless use of quotes." Thus:
open my $file, '<', $_ or die "Could not open `$_': $!\n"; [download]