HTH! :)sub is_included { my ($a,$b)=@_; # while ($a) { # UPDATED since buggy while (length $a) { my $c=substr($a,0,1); return 0 if $a =~ s/$c//g > $b =~ s/$c//g ; } return 1; } print is_included(qw/ababa babababab/); # 1 print is_included(qw/babababab ababa/); # 0 print is_included(qw/EASYPEASY PEARLYGATES/); # 0
Cheers Rolf
In reply to Re: Check if a word is included in another
by LanX
in thread Check if a word is included in another
by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |