in reply to Re^3: Perl Best Practices for naming variables
in thread Perl Best Practices for naming variables
The program I'm writing has grown to be many lines and I prefer as much clarity as possible when I reread sections of it. If helps document my intentions which helps when refactoring. And with all the subroutines I end up inventing, it makes for a clear set of expectations of what variables should be passed to the subroutine without having to use prototypes._ar for array ref _hr for hash ref _xr for code ref _sr for scalar ref
Frankly, I wish more books that teach Perl would use this approach because as the learner, it's hard enough trying to understand some new idea without having to fight through the additional ambiguity of "now what's in this variable and why is it written up that way?"sub foo { my ( $camels_ar, $votes_hr, $count_mechanism_xr, ) = @_;
|
---|