P is for Practical | |
PerlMonks |
Re^3: check possible combination of sum using given arrayby Athanasius (Archbishop) |
on Jul 09, 2019 at 06:27 UTC ( [id://11102584]=note: print w/replies, xml ) | Need Help?? |
Hello karlgoethebier, I just wondered if your sub find {# bla ...; return} compiles. Are you thinking of the missing semicolon? From perlsyn#Simple-Statements: Every simple statement must be terminated with a semicolon, unless it is the final statement in a block, in which case the semicolon is optional. Or were you worried about having a return without an explicit return value? From return: If no EXPR is given, returns an empty list in list context, the undefined value in scalar context, and (of course) nothing at all in void context. The only call to find in bliako’s script is find($T, \@input, $target, \@solutions);, which is a call in void context. So the bare return simply causes find() to exit immediately, by-passing the rest of the code in the subroutine. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|