in reply to Re^4: uninitialized value $_
in thread uninitialized value $_

> $_ automatically was assigned the last line 

That's a special DWIM magic within the while condition only!

while (<>) {

... which is Perl shorthand for the more explicitly written version: ...

while (defined($line = <ARGV>)) {

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^6: uninitialized value $_
by soonix (Chancellor) on Mar 29, 2016 at 08:13 UTC
    ... but not documented under while, but in perlop under "I/O-Operators" (where the internal link anchor seems not to work)
      I've already updated an excerpt of the documentation in perlsyn, but yes perlop is indeed clearer, thanks!

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!