That my Linux box (v5.8.8 built for x86_64-linux-gnu-thread-multi under Ubuntu) replicates the issue and my Windows box (v5.8.9 built for MSWin32-x86-multi-thread, I forgot I upgraded) does not implies something differs between the implementations. Running the Linux variety through my debugger shows $line to be undef on line 7 on the continuation case, whereas it maintains continuity under AS. Since we are dealing with a variable which is scoped at the loop, I was reading it as the variable was getting a new instance upon redo even though the my was not being re-evaluated. This is supported by the following code, which prints an infinite series of 1's on my Windows box and prints one 1 and then an infinite series of "Use of uninitialized value in print at fluff.pl line 6, <DATA> line 1." on my Linux box:
#!/usr/bin/perl -w
use strict;
use warnings;
while (defined(my $line = <DATA>) ) {
print $line;
redo;
}
__DATA__
1
Update: Better example code (I think). Prints 210 under Windows and 2 under Linux:
#!/usr/bin/perl
use strict;
use warnings;
my $j = 2;
while ( my $i = $j ) {
print $i if defined $i;
last unless $i--;
redo;
}
Update 2: Filed a bug report, id [perl #63752]
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|