in reply to 'my' buggy...

You're attempting to use a symref to access a lexical variable, which won't work since lexicals don't reside in the symbol table. This won't work either:

$ perl -le 'my $foo = 5; print ${"foo"}' $

A use strict would have produced a gripe.

Replies are listed 'Best First'.
Re: Re: 'my' buggy...
by december (Pilgrim) on Apr 30, 2002 at 16:15 UTC
    What is the correct way to access a lexical variable in a simple substitution then?...
      From the Perl FAQ, $text =~ s/(\$\w+)/$1/eeg;

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a (from-home) job
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

        Ow damn... never read that. Thanks :*)
        Crap... must have read over that. Or is it a new addition?

        Thanks anyway :*)