One of the ways to break from if - else in Perl is to use goto
if ($num =~ /^\d+$/){
if($num == 13){
goto ENDOFIF;
}
} else {
print "Number not found.\n";
ENDOFIF:
}
So if the number is 13 then it will break from the if and place the control right at the end of outer if.
Monday, January 18, 2010
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment