[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Substitution loop



On Jul 31, 2007, at 2:17 PM, Jay Hannah wrote:


Substitution loop at CommonShare.pm line 65.

line 65 looks harmless enough:

  $d1=~s/[^\d]//g;

Anyone seen that error before?

Diving....  :)

Andy Lester wrote:

You can also use the tr/// operator for this sort of thing, if you want.


Jay,

You said "Anyone seen that error before?" Did you mean to include the CommonShare.pm or a snippet of code? I've used the s///g; many times before and never really had a problem with it. (Note, I don't optimize for execution speed, rather readability and future "3AM support".)

It would be interesting to know which benchmarks faster, the "s///g" or "tr///" on your data...

Dan

--
- - - -
"Wait for that wisest of all counselors, time." -- Pericles "I do not
fear computers, I fear the lack of them." -- Isaac Asimov