in reply to Re: Match all Odd and Even Numbers
in thread Match all Odd and Even Numbers

Thanks for all your guidance. I got it working using this code:
for (@nums){ if ($_ % 2) { push (@odd, $_); } else { push (@even, $_); } }

Replies are listed 'Best First'.
Re^3: Match all Odd and Even Numbers
by bimleshsharma (Beadle) on Oct 12, 2012 at 06:27 UTC

    Do you mind to use below code

    my $num= [1 .. 100]; my (@even,@odd); map{0==$_%2 ? push(@odd,$_):push(@even,$_)} @$num; print "@even and @odd";