in reply to Re: Newbie question
in thread Newbie question

> Yet another inevitable TMTOWTDI:

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

    Or even:
        my @ans = grep 1 & sumdigits($_), @input;


    Give a man a fish:  <%-{-{-{-<

Re^3: Newbie question
by karlgoethebier (Abbot) on Aug 23, 2022 at 20:17 UTC

    "Monachus quidem varietas maxime delectat". Or so.

    «The Crux of the Biscuit is the Apostrophe»

      Excellent quote karlgoethebier! After all, it *is* the spice of life. :)

      "It's not how hard you work, it's how much you get done."