in reply to Regex to find intersection of two words
That's a better approach, in my opinion. You can use a regex too, but that would be a terribly ugly approach.# are all letters of X in Y? sub inclusive { my ($src, $dst) = @_; my %p; # I don't know which of these is optimal... # so I leave it up to you # for my $c (split //, $src) { while (defined(my $c = chop $src)) { return if !($p{$c} = 1 + index($dst, $c, $p{$c} || 0)) } return 1; }
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
|---|