in reply to Finding One String in Another
I like the logic, but would be inclined to slim the code a tad:
Updated to include length check.
sub match($$$) { my ($self,$letters,$word) = @_; return 0 if length $letters < length $word; $lcount{$_}++ for lc($letters) =~ /./g; for (lc($word) =~ /./g) { return 0 unless $lcount{$_}--; } return 1; }
--
Steve Marvell
|
|---|