in reply to searching problem
I was thinking of something along these lines:
#!/usr/bin/perl -l BEGIN { $| = 1; $^W = 1; } use strict; use warnings; use List::MoreUtils 'any'; my($string) = q(mamy dady bal foo bar); my(@allwords) = split(" ", $string, 0); my($revwords) = join(" ", reverse(@allwords)); my(@strings_list) = scalar reverse $revwords; my $match = any( sub { /^ymam*/}, @strings_list, ); print "match" if $match; print "no match" unless $match;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: searching problem
by Lotus1 (Vicar) on Jan 18, 2013 at 22:27 UTC |
In Section
Seekers of Perl Wisdom