my @matches; for (@fields) { push @matches, /%%(\w+?)%%/g; } #### my @matches = map /%%(\w+?)%%/g, @fields;