for (@nums){ if ($_ % 2) { push (@odd, $_); } else { push (@even, $_); } }