raghuprasad241 has asked for the wisdom of the Perl Monks concerning the following question:
I started to play with perl for the past few months during my free time. I picked up programming perl which I think is among the very best of programming books...
Coming to the point, I found something along the lines in programming perl and it works when I test it on my command line. I believe programming perl is for intermediate perl programmers which I am not. Can any one help me understand why the print from the book is working fine, where as my print command is bombing other than the fact that one was written by Larry Wall and other one by lame me?
Jr. Monkperl -e 'my @scale=("A" .. "G"); my $note = -1; print (($note += 1) %= + @scale)' #Working fine 0 perl -e 'my @scale=("A" .. "G"); print (0 %= @scale);' # Not working Can't modify constant item in modulus (%) at -e line 1, near "@scale)" Execution of -e aborted due to compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl behavior with print command
by NetWallah (Canon) on Feb 17, 2016 at 16:59 UTC | |
by raghuprasad241 (Beadle) on Feb 17, 2016 at 17:19 UTC | |
by Discipulus (Canon) on Feb 18, 2016 at 08:11 UTC |