On Wed, Dec 08, 2004 at 10:38:37AM -0000, Orton, Yves wrote: > Steve Peters wrote: > > This does not appear to be a bug. Quoting "Programming Perl, Second > > Edition", "The redo command restarts the loop block without evaluating > > the conditional again." So, when it re-enters the block, the shift is > > not performed and $i is implicitly defined to undef and the previous > > value is lost. > > If your interpretation of this is correct then I think the documentation > should be changed to clarify the point. I wouldn't have expected this result > from that description. In fact that description makes me think that > > my @a=(2..5); > while (my $x=shift @a) { > print $x,"\n"; > redo if $x--; > } > > and > > my @a=(2..5); > while (my $x=shift @a) { > STARTBLOCK: > print $x,"\n"; > goto STARTBLOCK if $x--; > } > > should be equivelent, but by your reading they aren't. I'm with Yves on this one. -- Thank God I'm an atheist.....Thread Previous | Thread Next