in reply to accumulating rex-exp matches in an array

This is untested but should work, especially if each AAA code is seperated by a comma.
my @list; while (<INFILE>){ my @line = split/,/,$_; for (@line){ m/(AAA.\d)/; push @list, $1; } }