in reply to Lotto checker...
G'day fishy,
Applying this advice from Arunbear and bigj:
my %draw = map { $_ => 1 } qw( ... ); my @bets = ( ... );
You can reduce your original code, which is somewhat difficult to read and maintain, to just this:
print for map { my $hits = grep { $draw{$_} } @$_; "@$_ --> $hits" . ($hits > 2 && ' *') } @bets;
My test code and results are in the spoiler:
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Lotto checker...
by fishy (Friar) on Apr 16, 2014 at 14:22 UTC | |
by kcott (Archbishop) on Apr 16, 2014 at 22:14 UTC | |
by fishy (Friar) on Apr 17, 2014 at 17:53 UTC |