[Omaha.pm] Substitution loop

Jay Hannah jay at jays.net
Tue Jul 31 14:16:19 PDT 2007


On Jul 31, 2007, at 3:11 PM, Dan Linder wrote:
> You said "Anyone seen that error before?" Did you mean to include the
> CommonShare.pm or a snippet of code?

My original post contained the line of code:

> line 65 looks harmless enough:
>
>   $d1=~s/[^\d]//g;

Additional context won't help since $d1 is passed into the subroutine  
which contains line 65. Hence my immediate debugger attempt.

> I've used the s///g; many times before and never really had a  
> problem with it.

Yup.   s///g   is one of many indispensable tools in the Perl 101  
toolbox.

> (Note, I don't optimize for execution speed, rather readability and  
> future "3AM support".)

Indeed. The vast majority of time that is the way to go. Programmer  
time is orders of magnitude more expensive than a few extra CPU  
cycles nowadays.  :)

j

  


More information about the Omaha-pm mailing list