Im almost newbie in Perl. So just wondering about the differences between two ways of accessing a value in nested hash.
Consider the following hash:
my %hsh = (
'fruits' => {
'red' => 'apple',
'yellow' => 'banana',
},
'veg' => {
'red' => 'capcicum',
'yellow' => 'lemon',
},
);
#way 1
print $hsh{'fruits'}{'red'};
#way 2
print $hsh{'fruits'}->{'red'};
Both has same output apple
. But what is the difference between these two ways?