sub expand_number_list { my @matches; () = ($_[0] =~ / (match something) (??{munge the match and push it to @matches}) /xg); return @matches; }