in reply to Re^2: $_ not set in while <>
in thread $_ not set in while <>
> 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 ...
from https://perldoc.perl.org/perlsyn#For-Loops plus added my logic
is the same as this:for (my $i = 1; $i < 10; $i++) { ... }
{ my $i = 1; while ($i < 10) { ... } continue { $i++; } }
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|