R – Is hungarian notation applicable to Perl?

hungarian-notationnaming-conventionsperltypes

In Perl, reference to anything is a simple scalar, and has the $ sigil. It's sometimes hard to say what kind of reference it is.

I personally prefix variable names for references with a letter, which indicates ref type. Examples:

my $aValues = [];                # arrayref
my $hValue  = {};                # hashref
my $oValue  = bless {};          # object
my $sValue  = \(my $s = 'foo');  # scalarref
...

I've seen both supporters and opponents to such notation. Do you use it? Does it have any disadvantages?

Best Solution

Meh. Arrayrefs and hashrefs and the like don't end up being that confusing around here that the issue comes up for our Perl-data-types very often. (Also: $oValue? How generic can you be? What sort of an object is it?)

Give me semantic-units Hungarian notation instead: $size_bits, $size_bytes, $size_kb, $size_blocks, $size_mb, $size_gb. The underlying data type? Not as important as adding 3 bytes to 10 megabytes per second and getting 13. That is where Hungarian notation of some form is useful.

Related Question