http://www.perlmonks.org?node_id=998609


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

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";

Replies are listed 'Best First'.
Re^4: Match all Odd and Even Numbers
by Anonymous Monk on Oct 12, 2012 at 06:30 UTC