in reply to Using open in for loop
I assume you mean something more like this:
Which is fine but this is better:use strict; use warnings; my @array = qw/ foo bar baz blah /; for(my $i = 0; $i < @array; $i++) { print "$i $array[$i]\n"; }
use strict; use warnings; my @array = qw/ foo bar baz blah /; foreach my $filename (@array) { print "$filename\n"; }
Please notice I added use strict; and use warnings these are a MUST when you are learning perl.
Also notice I did not use the actual open - I simplified to find the real root of the problem
| 1)Gain XP 2)??? 3)Profit |
|
|---|