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


in reply to Re^2: $_ not set in while <>
in thread $_ not set in while <>

Hi

> In the above, a "my" variable cannot be defined and be used within the same comma statement or logical "and" statement, hence the "my $line;" before the loop conditional.

In that case I'd prefer the c-style for(;;) loop ...

update

from https://perldoc.perl.org/perlsyn#For-Loops plus added my logic

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery