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

Brian Hatch bri at
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;


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.

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 :

More information about the spug-list mailing list