tags:

views:

177

answers:

3

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  A: 

You can look at perldoc perlsyn for information

ghostdog74
+10  A: 
  • 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.

Nikhil Jain
+1  A: 

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.

David Harris