in reply to is $i=+3 valid?
You got your answer already to change =+ to +=. However, why do not just experiment a little bit. It is really easy to write:
use strict; use warnings; my $i=0; $i=+3; print "$i\n"; # no errors, so far, prints 3, so we should be fine...? $i=+3; # better try again print "$i\n"; # still prints 3, so something must be wrong! $i=$i+3; # check whether Perl works correctly... print "$i\n"; # prints 6, what a relief
Experiments are fun! (Unless you are a theoretical physicist...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: is $i=+3 valid?
by Happy-the-monk (Canon) on Jul 05, 2013 at 08:32 UTC | |
by hdb (Monsignor) on Jul 05, 2013 at 09:54 UTC |