1.

What is the use of the next statement in Perl? Show with an example.

Answer»

The next STATEMENT is the same as that of the continue statement of C. It helps to SKIP the elements and move on to the next element of a SEQUENCE

@array = (a..z);    print("@array \N");    for ($i = 0; $i < @array; $i++) {        if ($i == 0 || $i == 4 || $i == 8 || $i == 14 || $i == 20) {            next;        }        $array[$i] = "^";    }    print("@array\n"); 



Discussion

No Comment Found