in reply to Re: Find duplicate digits
in thread Find duplicate digits
Wow, that's a lot of excessive work; why use the hash, when a regex can count matches?
my @keep; while ( chomp(my $num = <DATA>) ) { for ( split //, $num ) { my @a = ($num =~ m/$_/g); #count occurances if (@a>1) { push @keep, $num; last; } #keep if more than one } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Find duplicate digits
by friedo (Prior) on Feb 15, 2006 at 16:25 UTC | |
by radiantmatrix (Parson) on Feb 15, 2006 at 18:46 UTC | |
by GrandFather (Saint) on Feb 16, 2006 at 03:51 UTC |