in reply to Re: Sum of N elements in an M element array
in thread Sum of N elements in an M element array

I stared a little while at the code you provided wondering why and how it works and jumped to the conclusion that using Data::PowerSet is by far the better solution. Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Replies are listed 'Best First'.
Re^3: Sum of N elements in an M element array
by Anonymous Monk on Feb 02, 2020 at 00:44 UTC
    He's building a regex which is trying to match n numbers, because of the (fail) it keeps backtracking to match all possibilities.

    The embedded Perl code ensures the output before backtracking to the next match.

    I actual like seeing such code as answers to lazy questions. ;)