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