actually: *@x=(1,2,3,4);* *$z=*x;* *print "$z\n";* *print "@$z\n";* *print %$z."\n";*
produced: **main::x* *1 2 3 4* *0* which now baffles me even more :) On Sun, Apr 17, 2011 at 5:06 PM, Issac Goldstand <[email protected]>wrote: > I'm not sure, I understand. > > Let's take your example one step further and say we had values for @x and > %x > > Given the same code, if you tried to get @$y and %$y, you (probably) > wouldn't get anything useful. > > But if you tried to get @$z or %$z, you should get back @x and %x > > Yitzchak > > > > On 17/04/2011 17:02, Ronen Angluster wrote: > > a bit, > if i got this right, $z=*x is assigning the singleton(of sorts) of > "main::x" into $z? > > On Sun, Apr 17, 2011 at 4:58 PM, Issac Goldstand <[email protected]>wrote: > >> 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 >> [email protected]http://mail.perl.org.il/mailman/listinfo/perl >> >> >> >> _______________________________________________ >> Perl mailing list >> [email protected] >> http://mail.perl.org.il/mailman/listinfo/perl >> > > > _______________________________________________ > Perl mailing [email protected]http://mail.perl.org.il/mailman/listinfo/perl > > > > _______________________________________________ > 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
