Perl Monk, Perl Meditation | |
PerlMonks |
Re: Re: Re: Re: amount permutationsby gr0k (Novice) |
on Mar 05, 2004 at 15:26 UTC ( [id://334242]=note: print w/replies, xml ) | Need Help?? |
Ah, what I meant was, with your code, if there were two checks with the same amount. ie. A = 10 and G = 10, it wouldn't match a search for amount 20 since your array would look like this: my $RS = [10, 5, 13, 3, 15, 1, 4, 10]; And your line here return 0 if $uniq{$val} > 1; would ignore it thinking it was a duplicate in the sequence. It was a very slight change to pass the array of unique checks instead of the array of amounts and then: $sum += $rs_ref->{$check}->{'amount'};
In Section
Seekers of Perl Wisdom
|
|