sub baz { return 11 unless shift } print 'baz(5): ', baz(5), "\n"; print 'baz(0): ', baz(0), "\n"; __END__ baz(5): 5 baz(0): 11 #### my @a = ( qw (onexxx txwxo txhrexe xfourx xxx five) ); my @b = map { $_ =~ s/x//g; $_ ? $_ : (); } @a; print Dumper(\@b); __END__ $VAR1 = [ 'one', 'two', 'three', 'four', 'five' ]; #### $VAR1 = [ 'one', 'two', 'three', 'four', '', 'five' ];