in reply to Regex to find intersection of two words
sub weirdmatch { my ($foo, $bar) = @_; $bar =~ s/\Q$1// or return 0 while $foo =~ s/(.)//; return 1; } print weirdmatch('the' => 'there'); # 1 print weirdmatch('foo' => 'raboof'); # 1 print weirdmatch('moo' => 'monkey'); # 0
|
|---|