map { /(\d+)/; $1 } #### $ perl -le' use Data::Dumper; my @y = map { /(\d+)/; $1 } qw/ ab123cd ab456cd abcdefg ab789cd /; print Dumper \@y; ' $VAR1 = [ '123', '456', undef, '789' ]; #### $ perl -le' use Data::Dumper; my @y = map /(\d+)/, qw/ ab123cd ab456cd abcdefg ab789cd /; print Dumper \@y; ' $VAR1 = [ '123', '456', '789' ];