|Pathologically Eclectic Rubbish Lister|
I doubt if it is a scoping issue. The script works as expected on my Windows XP Pro ActiveState Perl v5.8.8 [MSWin32-x86-multi-thread]. The OP has a problem with the script under Linux Perl v5.8.8 but no problem under Linux Perl v5.10.0.
If you are right, that means that the scoping rules would be different between Windows and Linux? Seems strange to me.
But I see the same output (but not the warnings!) as the OP if I replace the redo with next and that is as expected.
The difference between redo and next being that redo does not re-evaluate the condition, whereas next of course does. In other words, with redo you do not run the defined(my $line = <DATA>) again, so the accumulation of the "broken" lines work and hence it cannot be a scoping issue since you never leave, nor re-enter the scope.
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re^2: Reading a text file collapsing line continuations