in reply to Save first n values from a file

file handles return single lines in scalar context

while ( my $a =<DATA> ){ my $b=<DATA>; my $c=<DATA>; print $a; } # while ( my $a =<DATA>, my $b=<DATA>, my $c=<DATA> ){ # print $a; # } __DATA__ a b c d e f g h

please note the difference, the second version will stop after printing "d", since the last group has only 2 entries (i.e. $c is undef)

Cheers Rolf

( addicted to the Perl Programming Language)