Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Hungarian notation, kind of

by davido (Archbishop)
on Jan 21, 2013 at 17:43 UTC ( #1014502=note: print w/ replies, xml ) Need Help??


in reply to Hungarian notation, kind of

I find it particularly useful when unpacking args that are passed as references. Then I can look at the subroutine and remember immediately to pass a reference rather than a list.

# Using two-letter notation... sub foo { my( $something, $that_ar ) = @_; foreach my $item ( @{$that_ar} ) {... }

I know at a glance that this sub takes an array ref. If I didn't use some sort of notation, and if the sub's code were a little more complicated, it helps to clarify.

I'm in the habit of using (mostly) four-letter versions: _aref, _href, _fh, _sref. Perhaps there's value in shortening the identifiers by a couple of strokes (line length), but old habits die hard.


Dave


Comment on Re: Hungarian notation, kind of
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014502]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2015-07-30 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls