develooper Front page | perl.perl5.porters | Postings from August 2009

Re: [DOC] Modernization: perlsyn

Thread Previous | Thread Next
Paul LeoNerd Evans
August 31, 2009 13:05
Re: [DOC] Modernization: perlsyn
Message ID:
On Sun, 30 Aug 2009 23:47:32 +0200
Elizabeth Mattijsen <> wrote:

> Should we mention that you can write any variable like $foo also as $ 
> {foo}?  Or even as ${"foo"} if you don't have strict enabled?

Not strictly true (pardon the pun):

$ perl -e 'no strict; my $foo = 10; print ${"foo"}'

$ perl -e 'no strict; my $foo = 10; print ${foo}'

${"foo"} is a soft reference to the SCALAR part of a symbol called "foo"
in the current package.  my $foo  does not create a package symbol, only
a lexical one.

Paul "LeoNerd" Evans
ICQ# 4135350       |  Registered Linux# 179460

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About