Chris Knipe wrote:
Hi,

Hello,

I was just wondering, when we talk about integers specifically,

Why integers specifically?  The same applies for any scalar value.

what's the difference between:
my $foo = 1;
my $bar = 1;

and

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.

The first is doing the assignment in scalar context. The second is assigning in list context, with a list of two scalars on the left and a list of one scalar on the right. With list assignment, all scalar variables are assigned first up until the first aggregate (array or hash) which will receive all the rest of the values leaving nothing for any subsequent variables.



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/


Reply via email to