C
ctcgag
I expect the program below to go into an infinite loop after print 9,
but instead it errors out. Why can't it find the label REDO?
I plead guilty to leaving a sub through redo, but the rest of it
I swear I'm innocent.
#perl -w
use strict;
REDO:foreach(1..1000) {
$SIG{ALRM}=sub {redo REDO};
alarm 10;
system "sleep $_"; # don't use builtin sleep, just in case.
alarm 0;
print "$_\n";
};
__END__
1
2
3
4
5
6
7
8
9
Exiting subroutine via redo at - line 3.
Exiting eval via redo at - line 3.
Label not found for "redo REDO" at - line 3.
Xho
but instead it errors out. Why can't it find the label REDO?
I plead guilty to leaving a sub through redo, but the rest of it
I swear I'm innocent.
#perl -w
use strict;
REDO:foreach(1..1000) {
$SIG{ALRM}=sub {redo REDO};
alarm 10;
system "sleep $_"; # don't use builtin sleep, just in case.
alarm 0;
print "$_\n";
};
__END__
1
2
3
4
5
6
7
8
9
Exiting subroutine via redo at - line 3.
Exiting eval via redo at - line 3.
Label not found for "redo REDO" at - line 3.
Xho