for (@temp) { push @a, $_ if s/^a_//; push @b, $_ if s/^b_//; } #### my %hoa; s/^([a-z])_// and push @{$hoa{$1}}, $_ for @temp;