in reply to Re: Parse $ Variable in text file
in thread Parse $ Variable in text file

s/\$(\w+)/${$1}/g;

Symbolic references like ${$1} are a bad idea, and that's why strict disallows them.

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Replies are listed 'Best First'.
Re^3: Parse $ Variable in text file
by gellyfish (Monsignor) on Jan 11, 2005 at 15:17 UTC

    More specifically it doesn't work with lexical (my) variables - you will need to use package variables instead.

    /J\

Re^3: Parse $ Variable in text file
by insaniac (Friar) on Jan 11, 2005 at 15:09 UTC
    ok thanks!... then someone needs to update perldoc -q "expand variable" because i just quickly copied and pasted it ;-)

    i didn't even test the code.. since it looked so obvious. but, once more!, ppl slap me around the ears saying: "use strict" and try out your code !
    one day i'll learn... one day ;-)

    --
    to ask a question is a moment of shame
    to remain ignorant is a lifelong shame