Copyright © tutorialspoint.com

# PERL next Keyword

## Syntax

next LABEL next

## Definition and Usage

This is not a function. Causes the current loop iteration to skip to the next value or next evaluation of the control statement. No further statements in the current loop are executed. If LABEL is specified, then execution skips to the next iteration of the loop identified by LABEL.

## Return Value

- Nothing

## Example

Try out following example:

    #!/usr/bin/perl -w

    @list = (1,2,3,4,5,5,3,6,7,1 );

    foreach $key ( @list ){
       if( $key == 5 ){
    	next;
       }else{
    	print "Key value is $key\n";
       }
    }

It will produce following results:

    Key value is 1
    Key value is 2
    Key value is 3
    Key value is 4
    Key value is 3
    Key value is 6
    Key value is 7
    Key value is 1

Copyright © tutorialspoint.com