0

In Perl, how do I use the next statement? In all sample programs I see the statement expressed like this: next LINEP

I do not understand what that label is doing. Can any one help me with an easily understandable example?

3 Answers 3

11
  • Have a look of next LABEL.

  • It would be nice if you read the topic Loop labels from Chapter 6 Control Structures in
    Perl Best Practices by Damian Conway that will explain you "Label every loop that is exited explicitly and use the label with every 'next', last or redo".

Then you will come to know why and how to use next command with Label.

3

You can look at perldoc perlsyn for information

2

As the good book states, next is used to start the next iteration of a loop. The loop being referenced in your example will have the label LINEP where the loop begins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.