> Is the moral of this story "Don't use regexps unless nothing
> else will solve the problem?".

First, it even wasn't me who gave this idea - I met it twice in both
"Effective Perl Programming" and "Data Munging with Perl".

Second, the moral, I think, is "do whatever is good for your eyes but
think about efficiency too". And string operators should be more efficient
then regexes ( well, I didn't implement them but it can't be any other
way )
Sometimes, a combination of index + substr gives the same result as one
regex, but takes 3 lines of code - I take regexes in this case.
But "lc( $ans ) eq 'y'" is a tiny work - why applying such
a big thing as a regular expression mechanism for it ?

TMTOWTDI


Reply via email to