DB<1> @a = qw (foobar barfoo foobaz, bar, foobor); DB<2> @c = grep {s/fo(ob.).+/$1/} @a; DB<3> x @c 0 'oba' 1 'oba' 2 'obo'