- or download this
[
# First loop: all item indices
...
: []
} ) x $#items,
],
- or download this
for $_ ( 0..$#items ) {
# ...
...
}
}
}
- or download this
OnlyWhen => sub {
# Compute sum of selected items as
...
# Return subsets that match desired sum:
return $sum[@_] == $target;
},
- or download this
@_= ();
for $_ ( 0..$#items ) {
...
}
pop @_;
}
- or download this
$sum[@_] < $target ? [ ($_+1)..$#items ] : []
- or download this
next if $target <= $sum[@_];
- or download this
@_= ();
for $_ ( 0..$#items ) {
...
} continue {
pop @_;
}
- or download this
while( my @list= @items[ $iter->() ] ) {
warn "$target = sum( @list )\n";
}