Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Scurbbing a string

by Anonymous Monk
on Aug 25, 2007 at 09:17 UTC ( #635035=note: print w/replies, xml ) Need Help??


in reply to Re: Scurbbing a string
in thread Scrubbing a string

Won't that fail, or even produce incorrect results, if $ctl includes tr metacharacters?

Replies are listed 'Best First'.
Re^3: Scurbbing a string
by BrowserUk (Pope) on Aug 25, 2007 at 09:57 UTC

    Yes. But remember that $ctl in that snippet is the equivalent of the OPs $pure, not the variable being cleaned.

    Still, I guess they could legitimately contain meta chars. If the OPs $pure variable(s) are sourced from outside of his program or genuinely might contain meta characters, then a quotemeta would probably be appropriate.

    Indeed, it might be good if that were mentioned in the eval tr example in perlop.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: Scurbbing a string
by BrowserUk (Pope) on Aug 28, 2007 at 02:33 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2021-04-15 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?