http://www.perlmonks.org?node_id=972432


in reply to RFC (possible new tutorial) Guide to references; The Basics

I think these two examples in your cheat sheet ending might be seen as confusing in that the values are assigned to scalars and force scalar context, which ultimately is not what the comment is claiming above the program statements.

# access the entire array through its reference my $elem_count = scalar @{ $aref }; # access the entire hash through its reference my $keys_count = keys %{ $href };

I get the point that the %{} and @{} make the hash reference into regular hash context, and the array reference into array context, but the final result in the examples in both are actually scalars, so the end result is the number of array elements, and the number of keys of the hash that's referred to by the variable. Perhaps that's a bit complex for a simple cheat example. Dunno, or you might want to clarify the comment to reflect the end result.

Of course the names of the variables is a good choice, but I don't know if that's sufficient.