Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: random variable declaration based on given count

by hippo (Abbot)
on Mar 26, 2014 at 11:15 UTC ( #1079805=note: print w/replies, xml ) Need Help??


in reply to random variable declaration based on given count

Seeing something like this:

my ($var,$var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11,$var12,$var13);

raises the obvious question. Why are you not using an array instead? If you do that, likely most of the related problems would disappear.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1079805]
help
Chatterbox?
[Eily]: choroba but does $name = $1 solve the issue ?
[Eily]: if so, most subs start with my (VARIABLES) = @_ anyway
[moritz]: for short subs, I sometimes let them work on $_[0] directly
[Eily]: moritz but that should be fine unless you modify them

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2018-02-22 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (296 votes). Check out past polls.

    Notices?