in reply to Tutorial RFC: Guide to Perl references, Part 1
Thank you for this tutorial. You've helped clear up one thing that has probably caused me some confusion when reading others' Perl code, which is that the curly braces have two different purposes. One is to dereference arrays and hashes. For example:
my @myarray = @{ $aref } ; my %myhash = %{ $href } ;
The other use is to reference a hash value by means of its key:
my $hash_value = $myhash{ $keyA } ;
But is there some consistent logic to this? That is, does the internal Perl logic consider a key of a hash to essentially be a reference to the storage holding its associated value?
And are there any other "gotchas" in Perl that typically cause confusion in newbies?
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Tutorial RFC: Guide to Perl references, Part 1
by LanX (Saint) on May 03, 2019 at 17:25 UTC |