in reply to while or for?

There isn't any special case as some may have argued. It is merely the context of <> when it's called. In your for statement, the contents of ARGV are slurped (the list foreach iterates over is built when the loop is constructed...don't believe me? perl -le '$_=4;$_++,print foreach (1..$_)'). Thus $ARGV is set to $ARGV[-1] for the duration of the loop. If you were to change your for statement to the following:

for (;<>;) { chomp; push(@{$para{$_}}, $ARGV); }

It will DWYM and work as expected. Now before anyone with B::Deparse tries to deparse it and notices that it optimizes this loop to while (defined($_ = <>)) ..., if you change the loop to for (my $i=0;<>;$i++) ... it will deparse to a for statement but still DWYM.

Hope this helps.

antirice    
The first rule of Perl club is - use Perl
The
ith rule of Perl club is - follow rule i - 1 for i > 1