On Jul 28, Balint, Jess said:
>Hello all. I am getting an error with the following reg-exp:
>
> s/\$\{(\w+)\}/$$1/g;
>
>I am not sure exactly how to do this type of thing. Is there any way to get
>around the error or must I turn off 'strict refs' for this line?? Thanks
>alot.
If you're trying to expand variables in a string, have you looked at:
perldoc -q variables
Anyway, I suggest something like:
s/\${(\w+)}/"\$$1"/eeg;
or perhaps the simpler
s/(\${\w+})/$1/eeg;
But it's even safer to use a hash, like the FAQ I mentioned suggests.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]