Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Reading in data that is

by mikeB (Friar)
on Oct 10, 2001 at 20:09 UTC ( #118031=note: print w/replies, xml ) Need Help??


in reply to Re: Reading in data that is
in thread Reading in data that is

I'm curious why you used

s/"//g;

rather than

tr/"//d;

I don't advocate speed optimization at the expense of clarity, but in this case both seem clear to me, and I'd expect tr/// to not use the regex engine and thus be faster.

Replies are listed 'Best First'.
Re: Re: Re: Reading in data that is
by dragonchild (Archbishop) on Oct 10, 2001 at 20:58 UTC
    *laughs* You know, I've never once used tr in a script that didn't involve cut'n'paste from someone else. TMTOWTDI at its best (worst?)! Yes, tr is faster in this specific instance. No, I'll probably never use it because I very rarely (if ever!) do straight character substitutions. If I'm stripping out characters, I'm doing that as part of a series of substitutions, usually involving s/\s//g and not some specific character(s).

    If you can read either, use the faster one. But, please note that speed of execution is not Perl's strong suit. It's good at that, but speed of development is why most people use Perl. In that vein, s/"//g is just as good.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2022-01-28 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (73 votes). Check out past polls.

    Notices?