Old code: my @b; foreach (@a) { if (/(gold\w+)/) { push @b, $1; } } New code: my @b = map { /(gold\w+)/ } @a; map gets the matches only ($1), not the entire original string. :) j