in reply to Re^2: my $x or my ($x)
in thread my $x or my ($x)
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;
Never fear. Just move your my.
This is particularly more useful in cases where you already have a declared variable.
my (undef, $foo, undef, $bar) = @array;
Never fear. Just move your my.
(undef, my $foo, undef, my $bar) = @array;
This is particularly more useful in cases where you already have a declared variable.
my $foo = "ab"; (my $avar, $foo) = ($foo =~ /(.)(.)/);
my @a=qw(random brilliant braindead); print $a[rand(@a)];
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: my $x or my ($x)
by benizi (Hermit) on Apr 25, 2006 at 15:45 UTC |
In Section
Seekers of Perl Wisdom