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

Re: [MacPerl] interpolating



On Thu, Dec 02, 1999 at 03:41:59PM -0700, A K Suska wrote:
> > Straightforward but inelegant:
> > 
> > s/<!--(\$[a-zA-Z_]\w*)-->/$$1/g;
> > 
> > This treats the value of $1 as a symbolic reference to another variable.
> 
> better to do:
>     s/<!--\$([a-zA-Z_]\w*)-->/${$1}/g;

Yup, the dollar sign should not have been part of the symbolic reference.
Thanks for the correction!


> Unless you use strict, where you would have to use Ken William's suggestion:
>    s/<!--(.*?)-->/$1/eeg;

Just be careful about what gets put in the comments.

Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org