Hi Ronen! The former (\$x) is a reference to the scalar value of x ($x). The latter is a pointer to the symbol table for all symbols called "x".
So when you're doing $\$x ($$y) you're asking for the scalar value of the reference to the scalar 1 When you're doing $*x ($$z) you're asking for the scalar entry in the symbol table for symbol x (also 1). Does that clear things up for you? Yitzchak On 17/04/2011 16:52, Ronen Angluster wrote: > Hi all! > happy passover! > > i've been wondering and could not find anyone who could explain > to me what is the difference between \$var to *var... > consider the following: > *$x=1;* > *$z=\$x;* > *$y=*x;* > *print "$y\n$z\n";* > would print: > **main::x* > *SCALAR(0x1951ac8)* > > but if we:*print "$$y\n$$z\n";* > the output would be: > *1* > *1* > > so, why use 1 against the other? what does it mean that the pointer is > to the class and > not to the memory space of the variable? > > > Ronen > > > _______________________________________________ > Perl mailing list > [email protected] > http://mail.perl.org.il/mailman/listinfo/perl
_______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl
