Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: searching problem

by Lotus1 (Chaplain)
on Jan 18, 2013 at 22:57 UTC ( #1014151=note: print w/ replies, xml ) Need Help??


in reply to Re: searching problem
in thread searching problem

The way I understood the OP was print out the word which when in reverse matches any other word. Your solution does the opposite. For example instead of printing bar since 'rab' matches in arabic, it prints arabic. ymamaa was also printed since 'mamy' in reverse matches it. My point is that arabic in reverse doesn't match anything.

#!/usr/bin/perl use warnings; use strict; my @words = qw(mamy dady bal foo bar xrabbit ymamaa arabic); my $list = join ' ', @words; foreach( @words ) { my $rev = reverse $_; print "$_\n" if $list =~ /$rev/; } __END__ mamy bar


Comment on Re^2: searching problem
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-12-27 16:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls