Locate all numbers less than 6
@numbers = ( 1 .. 10 ); print "\@numbers: @numbers\n\n"; foreach ( @numbers ) { push( @smallNumbers, $_ ) if $_ < 6; } print "Numbers less than 6:\n", "foreach: @smallNumbers\n";