Re: confused about reference
- From: rich.japh@xxxxxxxxx (Richard Lee)
- Date: Fri, 31 Oct 2008 00:19:51 -0400
Richard Lee wrote:
@{$yahoo->{yahoo}} has @ on it because it's value of yahoo is reference. Is this right?
I was just testing some reference and while trying out below I am trying to understand below
@{$yahoo->{yahoo}}........... I can see that this is pointing to 0,1,3 by running the code.
But I am trying to really understand whether this is trying to say since value of 'yahoo' is array put @ at the front?
or @ is there because it's array slice??
Can someone explain this?
This one, I cannot figure it out............
Also, %{$base[0]}, trying to understand this.
According to the tutorial,
%base referenced is %{$base}
what is the difference between %{$base[0]} vs %{$base}[0] Are we here talking about first being hash reference which first item is array reference vs second one is hash reference's first item ?
thank you.
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
my $yahoo = { 'yahoo' => [ 0, 1, 3],
'msn' => [ 12, 32, 44]
};
print Dumper($yahoo);
print "\n\n\n\n\n------------------------------------------------------------\n";
print "${$yahoo}{yahoo}[0]\n"; # prints 0
print "$yahoo->{yahoo}[0]\n"; # prints 0
print "@{$yahoo->{yahoo}}\n"; # prints 0,1,3
print "%{$yahoo->{yahoo}}\n"; # print %{ARRAY(0x832e8c4)}
.
- References:
- confused about reference
- From: Richard Lee
- confused about reference
- Prev by Date: Re:confused about reference
- Next by Date: Re:confused about reference
- Previous by thread: confused about reference
- Next by thread: Re:confused about reference
- Index(es):
Relevant Pages
|