goto LABEL goto EXPR goto &NAME |
Nothing
試試下麵的例子:
#!/usr/bin/perl
#by www.gitbook.net
$count = 0;
START:
$count = $count + 1;
if( $count > 4 ){
print "Exiting program\n";
}else{
print "Count = $count, Jumping to START:\n";
goto START;
}
It produces following result
Count = 1, Jumping to START:
Count = 2, Jumping to START:
Count = 3, Jumping to START:
Count = 4, Jumping to START:
Exiting program