in reply to Word Comparison
I do this in word twist, which you may want to look at.for ([qw/dog good/],[qw/food fodder/]) { my ($first, $second) = @$_; print "$first does "; print "not " unless join("",sort split //,$second) =~ join(".*",sort split // +,$first); print "contain $second\n"; }
is possibly a faster way - I haven't benchmarked.join("",sort split //,$first) =~ ("^".join("?",sort(split //,$second)) +."?\\z")
|
|---|