On Sun, 30 Aug 2009 23:47:32 +0200
Elizabeth Mattijsen <liz@dijkmat.nl> 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}'
10
${"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
leonerd@leonerd.org.uk
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
Thread Previous
|
Thread Next