On Friday 19 Mar 2010 13:45:31 trapd...@trapd00r.se wrote: > On 19/03/10 13:19 +0200, Chris Knipe wrote: > >my ($foo, $bar) = 1 > > > >I am getting more and more occurances where when I use the later as above, > >$bar would not have a defined value... I'm not quite sure I understand > >why. > > Does; > my ($foo,$bar) = 1 x 2; > do what you want?
<<< shlomi:~$ cat 1x2.pl #!/usr/bin/perl use strict; use warnings; my ($foo, $bar) = 1 x 2; print "Foo = $foo\n"; print "Bar = $bar\n"; shlomi:~$ perl 1x2.pl Foo = 11 Use of uninitialized value $bar in concatenation (.) or string at 1x2.pl line 9. Bar = >>> 1 x 2 is string replication. You probably want list replication with : <<< my ($foo, $bar) = (1) x 2; >>> Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ List of Portability Libraries - http://shlom.in/port-libs Deletionists delete Wikipedia articles that they consider lame. Chuck Norris deletes deletionists whom he considers lame. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/