Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Assign multiple scalars the same value

by xdg (Monsignor)
on Jan 25, 2005 at 19:44 UTC ( #425019=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Assign multiple scalars the same value
in thread Assign multiple scalars the same value

Good point. One could always do this:

use Want 'howmany'; my ($a, $b, $c) = &{ sub{ (1) x howmany } };

Not sure if that's shorter/better than other solutions (plus requires Want), but it's another way of keeping the number of variables in sync.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.


Comment on Re^3: Assign multiple scalars the same value
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-11-28 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (197 votes), past polls