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


in reply to Re: perl leaving out the last value?
in thread perl leaving out the last value?

while (defined($symbol = <IN>))

With this particular construct, Perl automatically adds the defined(), so you can safely omit it if you prefer brevity.

$ perl -MO=Deparse -e'while ($symbol = <IN>) { chomp($symbol) }' while (defined($symbol = <IN>)) { chomp $symbol; } -e syntax OK