Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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 :)

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://549836]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2017-07-22 05:20 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (337 votes). Check out past polls.