in reply to Re^4: Improve readability of Perl code. Naming reference variables.
in thread Improve readability of Perl code. Naming reference variables.

Now you've circled back around to scope size again. If your sub is around one screenful of code, it's easy to know what each var is and does, because you can at a glance see it in use without paging or having to search an entire file.

Then, you have your documentation (you did write documentation, right? ;)

Often when I'm writing new modules or updating older ones, I have the current documentation open in either a browser or another terminal window. Your documentation will provide you with the function/method declaration, and will clearly describe what each parameter is. I'm not advocating using comments here, I'm just saying in rare cases where it may be ambiguous to the reader, throw in a comment. fwiw, I don't recall over the last year ever having to specify what a variable is via comment in any of my code.

In your example, with those names, I immediately and instinctively knew which type each param was. If I was to update that sub, the worst thing that would happen would be an error spit out because I mistakenly used the variable as a different type, and since I test code extremely often, there wouldn't be much I'd have to go back and change to correct my oversight.