http://www.perlmonks.org?node_id=1031724


in reply to reading two files in parallel

Something like this?

while (1) { my $a = <F1> or last; my $b = <F2> or last; # use $a and $b here }

Replies are listed 'Best First'.
Re^2: reading two files in parallel
by morgon (Priest) on May 02, 2013 at 14:49 UTC
    This is a nice way to do it, however I would alaways advice against using $a and $b as variable names as they are "magic" names for sorts and bugs where your variables are then shadowed in a sort can be hard to track down, so better avoid potentially troublesome names.