Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: char substitution without regexes

by ikegami (Patriarch)
on Sep 30, 2010 at 18:10 UTC ( [id://862820]=note: print w/replies, xml ) Need Help??


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

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;

Replies are listed 'Best First'.
Re^4: char substitution without regexes
by jwkrahn (Abbot) on Sep 30, 2010 at 18:16 UTC

    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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2026-04-20 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.