while () { if (my @matches = m/(AAA\.\d)/g ) { push @list, @matches; } }