Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: simple letter substitution according to hash

by Jasper (Chaplain)
on May 16, 2006 at 18:01 UTC ( #549836=note: print w/ replies, xml ) Need Help??


in reply to simple letter substitution according to hash

s/$key/$value/g while ($key, $value) = each %codewheel;

also works, without any of the nasty joins, or evaluated regexes. Not sure I'd recommend it, though :)


Comment on Re: simple letter substitution according to hash
Download Code
That doesn't work.
by kbrint (Sexton) on May 16, 2006 at 20:14 UTC
    With the following:
    %codewheel = ( A => 'B', B => 'C', 'C' => 'D' );

    Your code changes 'ABC' --> 'BBC' --> 'CCC' --> 'DDD' and so on.

      Well spotted. That was stupid of me. I did say I didn't recommend it, didn't I? :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2014-12-28 17:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (182 votes), past polls