Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Surprise: "Can't modify constant item in scalar assignment"

by ikegami (Pope)
on Jan 19, 2012 at 19:41 UTC ( #948839=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    $ perl -ce'use strict; message = "foo";'
    Can't modify constant item in scalar assignment at -e line 1, near ""f
    Bareword "message" not allowed while "strict subs" in use at -e line 1
    -e had compilation errors.
  2. or download this
    $ perl -ce'use strict; sub message; message = "foo";'
    Can't modify non-lvalue subroutine call in scalar assignment at -e lin
    +e 1, near ""foo";"
    -e had compilation errors.
  3. or download this
    $ perl -ce'use strict; sub message :lvalue; message = "foo";'
    -e syntax OK
  4. or download this
    $ perl -ce'use strict; my message = "foo";'
    No such class message at -e line 1, near "; my message"
    syntax error at -e line 1, near "my message ="
    -e had compilation errors.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948839]
[Corion]: I guess in such situations tieing your child to a mobile phone makes sense so they can send you a text message...
[LanX]: well if everyone calls at the same time after earthquake, this might cause more confusion
[Discipulus]: just after earthquake mobile phones never work: but they could evacuate to open schoolyard and then call or go back to school
[LanX]: "evacuate to open schoolyard" is standard procedure here

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2017-01-18 12:01 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (161 votes). Check out past polls.