in reply to Re: char substitution without regexes
in thread char substitution without regexes

Yes, but, that uses a regex and the OP said "without regexes".

  • Comment on Re^2: char substitution without regexes

Replies are listed 'Best First'.
Re^3: char substitution without regexes
by ikegami (Patriarch) on Sep 30, 2010 at 18:10 UTC

    It passes a pattern, but it's actually special-cased not to use the regex engine.

    Ok, so I did it without thinking.

    print map $complement{$_}, reverse unpack '(a)*', $chain;

      Now you've got it!   :-)

      By the way, which do you think would be more efficient, reversing the list, or reversing the string first?

        Reversing an array of SV* or reversing an array of char (assuming UTF8=0)? We're talking about the same CPU ops.