Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Plural variable naming (or not?)

by JavaFan (Canon)
on Dec 11, 2009 at 10:08 UTC ( [id://812354]=note: print w/replies, xml ) Need Help??


in reply to Plural variable naming (or not?)

Just use both:
use Data::Alias; my @plural = qw[foo bar baz]; alias my @singular = @plural; say $singular[1]; $singular[2] = "qux"; say "@plural"; __END__ bar foo bar qux

Replies are listed 'Best First'.
Re^2: Plural variable naming (or not?)
by Tuppis (Initiate) on Jun 29, 2011 at 00:00 UTC
    Hi,
    Let's keep this oldies but interesting post running. :)
    PERL has a point in using singular even for arrays. That is the sigil. Saying @persons is superfluous, @ marks it's a list (an array) of something. $car[3] could be read for example as 'Third car in the array' or 'Car number three in the array'.
    Square brackets will reveal if it's an array if in doubt. Consistency is important. Perlstyle could give some advice also in this matter.
    Beers, T

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found