Why doesn't my continue execute the next when block in Perl 5.10?
Posted
by JoelFan
on Stack Overflow
See other posts from Stack Overflow
or by JoelFan
Published on 2010-03-29T16:27:58Z
Indexed on
2010/03/30
0:03 UTC
Read the original article
Hit count: 470
When I run this:
use feature ':5.10';
$x=1;
given ($x) {
when(1) {
say '1';
$x = 2;
continue;
}
when (2) {
say '2';
}
}
This should print both 1 and 2, but it only prints 1. Am I missing something?
EDIT:
I have added $x = 2 and it still prints only "1"
© Stack Overflow or respective owner