It can be used in cases where you want processing only for selected array elements and want
to ignore the rest.
Content of the perl file is:
@array=(1..10);
foreach $var(@array)
{
next if ( $var == 5 || $var == 6 );
print "The var value is $var"."\n";
}
OUTPUT :
G:\perl_programs>perl perl_next.pl
The var value is 1
The var value is 2
The var value is 3
The var value is 4
The var value is 7
The var value is 8
The var value is 9
The var value is 10
G:\perl_programs>
No comments:
Post a Comment