in reply to Re: my $x or my ($x)
in thread my $x or my ($x)
Although it's convenient that you can declare a whole lot of variables in one line, the big advantage is that you can handle assignments at the same time:
my ($foo, $bar) = @array;The only warning I can give is that using an undef in the list will throw warnings (errors?) in older versions of perl:
my (undef, $foo, undef, $bar) = @array;You can assign values from a list of scalars, as well, but I think it's less legible than assigning one at a time:
my ($foo, $bar, $baz) = (27, 'blah', $x);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: my $x or my ($x)
by ptum (Priest) on Apr 04, 2006 at 13:39 UTC | |
by eff_i_g (Curate) on Apr 04, 2006 at 15:35 UTC | |
Re^3: my $x or my ($x)
by Rhandom (Curate) on Apr 05, 2006 at 15:06 UTC | |
by benizi (Hermit) on Apr 25, 2006 at 15:45 UTC |
In Section
Seekers of Perl Wisdom