Going onto the Next : Next « Statement « Perl






Going onto the Next

 

#!/usr/bin/perl
use strict;
use warnings;
my @array = (8, 3, 0, 2, 2, 0);
for (@array) {
    if ($_ == 0) {
        print "Skipping zero element.\n";
        next;
    }
    print "48 over $_ is ", 48/$_, "\n";
}

   
  








Related examples in the same category

1.Using the next statement in a foreach structure.
2.Next statement
3.Next if
4.A word-counting program that uses the next statement.
5.Using both next and continue
6.next with condition
7.Next statement with if statement