in reply to Re^2: Collapsing multiple file open/close
in thread Collapsing multiple file open/close

There are two problems with that:

1) Creating symbols dynamically (FH$i) is pretty bad. I think you could use $FH{$i} instead (since Perl 5.6?), but your loop would become
while (<$FH{''}>) { print $FH{1} $_; }

2) You're opening both files for reading.

Replies are listed 'Best First'.
Re^4: Collapsing multiple file open/close
by ady (Deacon) on Apr 13, 2005 at 16:53 UTC
    Ahhhh, you're right!
    I'll leave it at that. I walk away with a better understanding of this issue.
    Interesting how clearity and beauty of code is in general correlated to compactness and efficiency, but there's that lower threshold, where the direct approach (however redundant) is preferable.
    Thanks, allan