in reply to Re^2: Check if a word is included in another
in thread Check if a word is included in another

Did you try it?

print wordCheck( 'onlyones', $_ ) for qw[ none noon noone lyoness ]; 1 1 1

Perhaps this will clarify:

sub wordCheck{ my $s = join '', sort split'', $_[0]; my $re = join'.*', sort split'', $_[1]; print "doing: $s =~ $re"; return $s =~ $re; } print wordCheck( 'onlyones', $_ ) for qw[ none noon noone lyoness ];; doing: elnnoosy =~ e.*n.*n.*o 1 doing: elnnoosy =~ n.*n.*o.*o 1 doing: elnnoosy =~ e.*n.*n.*o.*o 1 doing: elnnoosy =~ e.*l.*n.*o.*s.*s.*y

Replies are listed 'Best First'.
Re^4: Check if a word is included in another
by b4swine (Pilgrim) on Apr 18, 2010 at 23:11 UTC
    I did, but made the mistake of swapping the target and the word, so that the results came out wrong. Sorry for the complaint. Otherwise this is really very pretty. Of course credit also goes to jwkrahn for starting this thread.