Shlomi Fish wrote:
On Monday 08 Mar 2010 18:00:10 Ryan Chan wrote:
my ($a, $b, $c, $d, $e) = "test";
How I can assign "test" to all the list items? e.g. $a to $e
First of all, you should not name lexical variables "$a" and "$b" because
these are built-in Perl variables: http://perldoc.perl.org/perlvar.html .
Otherwise you can assign several variables the same initial value using the x
operator:
my ($x, $y, $z) = (("test") x 3);
Note that both pairs of parentheses on the right are required.
No they are not. Only the parentheses around "test" are required.
Another way to do it:
$_ = "test" for my ($x, $y, $z);
John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/