#! /bin/perl -w # script with next and unless statements @array = ( 1, undef, 4, undef); for ( $i = 0; $i < scalar (@array); $i++ ) { next unless ( (defined($array[$i])) ); print "undef found at $i\n"; }