in reply to Multiple Conditional Statements
The best solution to finding dupes is almost always a hash.
use strict; use warnings; my ($RB1, $RB2, $WR1, $WR2, $TE1) = (1, 2, 3, 1, 4); { my %lookup; for ($RB1, $RB2, $WR1, $WR2, $TE1) { if ($lookup{$_}++) { print "Dupe $_\n"; last; } }}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Multiple Conditional Statements
by dolmen (Beadle) on Sep 12, 2013 at 07:59 UTC | |
by TJPride (Pilgrim) on Sep 12, 2013 at 22:01 UTC |
In Section
Seekers of Perl Wisdom