Using grep function
@numbers = ( 1 .. 10 ); print "\@numbers: @numbers\n\n"; @smallNumbers2 = grep( $_ < 6, @numbers ); print "grep: @smallNumbers2\n\n";