Perl Labeled blocks
by Geethalakshmi[ Edit ] 2010-09-17 14:04:40
Perl Labeled blocks
Labeled blocks work similiar to 'goto' in other languages. It is recommended that the label name is in all upper case and only use letters or numbers. Also use a name that isn't or won't ever be used as reserved word, i.e. 'print' would not be a legal name to use for label. The name is always followed by a colon.
SOMELABEL: while (condition) {
statements;
if (somethingelse) {
otherstatements;
last SOMELABEL;
}
}