in reply to globbing filehandles in arrays

while(my $line=<$FH[$i]>){

<$FH[$i]> doesn't work for syntactic reasons, i.e. special parsing rules apply for <...>, and only simple expressions like <$fh> can be handled.

Use readline $FH[$i] instead, if you don't want to use an intermediate variable.

Update: also note that whitespace isn't allowed either, i.e. < $fh > and <$ fh> won't work... it has to be exactly <$fh>.

Replies are listed 'Best First'.
Re^2: globbing filehandles in arrays
by why_bird (Pilgrim) on Jan 26, 2009 at 08:38 UTC

    Ah, I didn't know that (either about readline or about special parsing rules for <...>).

    Thanks!
    why_bird
    ........
    Those are my principles. If you don't like them I have others.
    -- Groucho Marx
    .......