in reply to Optimizing a string processing sub
$class = ‘[a-z]’; @commonChars = compareChars( $class ); sub compareChars { $regex = shift; $requiredCount = @ARGV; for ( $i=0; $i<=$#ARGV; $i++ ) { while ( $ARGV[$i] =~ m/($regex)/gi ) { $found{$1} = $i + 1; } } while ( ( $key, $value ) = each %found ) { push @answer, $key if $value == $requiredCount; } return @answer; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Optimizing a string processing sub
by MarkM (Curate) on Jan 09, 2003 at 06:49 UTC | |
by Anonymous Monk on Jan 09, 2003 at 06:59 UTC | |
|
Re: Re: Optimizing a string processing sub
by clairudjinn (Beadle) on Jan 10, 2003 at 20:44 UTC |