in reply to regex verses join/split
I have a comment to make about your first method, with the regexes. You do three distinct substitutions. That's just silly. The whitespace at the beginning of a string and at the end of a string is going to be treated like ALL the OTHER whitespace, so you're only being inefficient by separating the clauses. And, as I've already mentioned, doing s/\s+$// is particularly inefficient. So your regex-method should merely be s/\s+//g. But you can probably do better with tr/\n\r\f\t //d.
_____________________________________________________
Jeff japhy Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: regex verses join/split
by bwana147 (Pilgrim) on Jul 27, 2001 at 13:04 UTC |