performance Re: string not block Re: SPUG: interpolating into a string variable

Brian Hatch bri at ifokr.org
Sun Dec 21 17:43:32 CST 2003



> Borrowing from the foregoing (and also from the perldoc, thanks YS-T) I
> settled on the following, which seems to be the fastest (notably so) of all
> (and also arguably much safer than eval):
> 
>     $s =~ s/\$(\w+)/defined($subs{$1}) ? $subs{$1} : $1/eg;

Cool.

It's nice to have someone obsessed with performance on this list.

--
Brian Hatch                  Kids in the back seat cause
   Systems and                accidents.  Accidents in
   Security Engineer          the back seat cause kids.
http://www.ifokr.org/bri/

Every message PGP signed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/spug-list/attachments/20031221/e11202a9/attachment.bin


More information about the spug-list mailing list