Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: searching problem (reverse substrings)

by LanX (Saint)
on Jan 18, 2013 at 10:33 UTC ( [id://1014030]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
     
    $str = join "\0",@wordlist,
    @reverts = map { "\0" . reverse $_ } @wordlist;
    $pattern = '(' . join('|',@reverts) . ')'  ;
    @matches = ( $str =~ /$pattern/g );
    
  2. or download this
      DB<131> @wordlist=qw(mamy dady bara foo bic ymamaa arabic );
     => ("mamy", "dady", "bara", "foo", "bic", "ymamaa", "arabic")
    ...
    
      DB<134> @matches = ( $str =~ /($pattern)/g );
     => ("\0ymam", "\0arab")
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1014030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2024-04-25 15:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found