in reply to Re: Newbie question
in thread Newbie question
KISS! s/map/grep/ ;-)
my @ans = map { (sumdigits($_) % 2) ? $_ : () } @input;
... my @ans = grep { sumdigits($_) % 2 } @input; ...
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Newbie question
by AnomalousMonk (Archbishop) on Aug 23, 2022 at 20:30 UTC | |
|
Re^3: Newbie question
by karlgoethebier (Abbot) on Aug 23, 2022 at 20:17 UTC | |
by roho (Bishop) on Aug 24, 2022 at 03:04 UTC |