Had you done use strict and use warnings you'd have gotten helpful diagnostics about leaving off the $ from $i in the for loop. That aside, a more natural way of writing that (presuming you've left out whatever processing you're doing for each file) would have been:
for my $file ( @array ) { open( FILE, $file ) or die "Can't open '$file': $!\n"; ## Do something with the contents of $file close( FILE ); }
In reply to Re: Using open in for loop
by Fletch
in thread Using open in for loop
by xmanamit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |