Chris Knipe wrote:
> Hi,
> 
> I was just wondering, when we talk about integers specifically, 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.
> 

If the variables have the same units, you can set their values all at once:

my $player1_score = my $player2_score = 0;

If their units are different, use separate lines:

my $apples = 0;
my $oranges = 0;

The reason for this is to make understanding of what's happening easier
for those that have to maintain your code.


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

Eliminate software piracy:  use only FLOSS.

-- 
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