Hello,
I am very novice about Perl.
How can I make the program go from one section to the other
one? I mean like the "goto" command.
Is it labels? If so, how do I use them and what is the syntax?
Thank you.
It would be labels, but they behave a little bit different than in BASIC--in that they are executed on the block that you are in. You have several choices: redo, next, last, and continue. The last three (next, last, and continue) only work with loops (for/foreach/while/until/do), redo works with both looping blocks as well as non-looping blocks. Here's and infinite loop using redo:
TESTING:
{
print "This is a redo test\n";
redo TESTING;
}
You can also use a conditional with redo, so that it doesn't have to be an infinite loop:
$quit=-1;
TESTING:
{
$quit++;
print "This is a redo test\n";
redo TESTING if $quit == 0;
}
However, in practice, it's much easier (and a bit more logical) to either use a do/while or a do/until or a sub.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.