in reply to Can this code be optimized further?

As long as everyone's just chiming in with different ways, if you don't mind modifying the original array:
for (@temp) { push @a, $_ if s/^a_//; push @b, $_ if s/^b_//; }
You could even modify this to use a HoA-type solution, e.g.(update: fixed code..still untested):
my %hoa; s/^([a-z])_// and push @{$hoa{$1}}, $_ for @temp;