2009/11/26 Marco Pacini <i...@marcopacini.org>:
> Hi All,
>
> I'm studying Perl since one week on "Learning Perl" written by L. Wall and in 
> the paragraph "Assignment Operators" i don't understand why this:
>
>        ($temp = $global) += $constant;
>
> is equivalent of:
>
>        $tmp = $global + $constant;
>
> Instead,  before i read it, i thought it was equivalent of:
>
>        $temp = $global;
>        $temp = $temp + $constant;

Let's relabel the first value of $temp as a new variable, $temp2:

my $temp2 = $global;
$temp = $temp2 + $constant;

Notice that $temp2 has just been given the value of $global, so this
second statement is the same as:

$temp = $global + $constant;

In other words, you're both right, because your version is equivalent
to $temp = $global + $constant.

Philip

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