symbolic reference

From: slurper (slurper1234_at_skynet.be)
Date: 01/29/04


Date: Thu, 29 Jan 2004 22:13:01 +0000

i don't understand following snippet from "programming perl".

$name = "bam";
$$name = 1; # Sets $bam
${$name} = 2; # Sets $bam
${$name x 2} = 3; # Sets $bambam
$name->[0] = 4; # Sets $bam[0]
i don't understand above. $name is a string and it gets dereferenced.
impossible no?
can anyone shed some light on this
tx very much

@$name = (); # Clears @bam
&$name(); # Calls &bam() (as in prior versions of Perl)
$pkg = "THAT"; # (Don't use "package" or "pack"!)
${"${$pkg}::$name"} = 5; # Sets $THAT::bam without eval