foreach (@transactions) { #there are dozens of employee numbers… if ($_ eq 01) { push (@joe , $_) ; } if ($_ eq 02) { push (@ed , $_) ; } if ($_ eq 03) { push (@sam , $_) ; } if ($_ eq 04) { push (@sam , $_) ; } if (no others) { push (@unregistered , $_) ; } }