How come that hash and array refs work so different or (more likely) is it me doing something terribly wrong here ??$hr->{a} = "hello" ; # or @$hr{a} = "hello" ; # doesn't work!!! $ar->[0] = "hello" ; # or @$ar[0] = "hello" ; # does WORK !!!! print "value of hr = $ar->[a]\n" ; print "value of hr = $hr->{a}\n" ; # or print "value of ar = ".@$ar[0]."\n" ; print "value of hr = ".%$hr{a}."\n" ; # doesn't work!!
In reply to A better understanding of array and hash references by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |