my ($var1, $var2, $var3... arbitrary number of vars) = 1,
which obviously doesn't work, but I hoped it's only due to my lack of syntax knowledge.


my $var1 = my $var2 = my $var3 = 1;

works. Still ugly?

alfred


Peter Rabbitson wrote:

On Fri, Mar 11, 2005 at 04:09:12PM -0500, Todd W wrote:


"Peter Rabbitson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


On Fri, Mar 11, 2005 at 12:45:10PM -0800, Wagner, David --- Senior


Programmer Analyst --- WGO wrote:


Peter Rabbitson wrote:


Is there a quick way to initialize a number of variables at once?
Something like

my ($var1, $var2, $var3);


my ($var1, $var2, $var3) = ( 1,1,1 );
Wags ;)


but instead of having undef in all of them, let's say I want to have
1 in each. Any takers?

Peter


But... isn't... this... ahem... like... um... ugly? :)


other than the program reading your mind, how could it be more consise?



Well, this would definitely be a very neat feature, I hope Larry Wall is reading this list and is already cracking on the new Telepathy::Simple :)


What I meant however was something along the lines of my ($var1, $var2, $var3... arbitrary number of vars) = 1, which obviously doesn't work, but I hoped it's only due to my lack of syntax knowledge.

Peter




--
Perl - "... making the easy jobs easy,
without making the hard jobs impossible."
'The Camel', 3ed



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to