in reply to globbing filehandles in arrays
<> is two different operators. Based on its operand, it's an alias for readline or it's an alias for glob. Here are two ways of forcing readline:
while (my $line = readline($FH[$i])) { ... }
my $fh = $FH[$i]; while (my $line = <$fh>) { ... }
There's still the question of why you are using global variables for no reason.
open(FILE_A,">","a.txt") || ...; open(FILE_B,">","b.txt") || ...; my @FH=(*FILE_A,*FILE_B);
should be
open(my $FILE_A,">","a.txt") || ...; open(my $FILE_B,">","b.txt") || ...; my @FH=($FILE_A,$FILE_B);
You're using 3-arg open which was introduced at the same time as lexical file handles, so it's not a backwards compatibility issue.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: globbing filehandles in arrays
by jwkrahn (Abbot) on Jan 23, 2009 at 14:04 UTC | |
|
Re^2: globbing filehandles in arrays
by why_bird (Pilgrim) on Jan 26, 2009 at 08:35 UTC | |
by ikegami (Patriarch) on Jan 26, 2009 at 13:54 UTC |