in reply to Only using scalers and references
These are just examples but I think it's worth mentioning that these sort of names-
$str = 'abc'; $hash = {} $hash->{'key'} = 'val'; $array = []; push @$array, 'val'; # one of the few times you ever use a @ or a % print $array->[0];
-rankle -- me at least -- badly. The idea that a string should be named "string" and hash has to be named "hash," implies that either the variables are undocumented and going to be used in such a large scope that you'd have to go hunting to see where/how they were created or that the coder didn't think much about how the next hacker would read the program on a macro-level.
Variables are the most basic and easily mastered thing in a language besides math operators. When I inherit code with single letter variable names, or unintelligibly abbreviated ones which save four characters of typing, or those which describe the actual variable instead of its contents and purpose I curse the person who wrote it. Other hackers don't need help differentiating SCALAR from HASH -- at least not after the first few weeks :) -- they need help seeing what the code is supposed to be doing. Choosing good variable and sub names is one of the kindest things you can do for your fellow hackers.
|
|---|