Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by LanX (Bishop)
on Jan 19, 2012 at 16:25 UTC ( #948806=note: print w/replies, xml ) Need Help??


in reply to Surprise: "Can't modify constant item in scalar assignment" [SOLVED]

> Did you spot it?

Yes, I did!

If you don't, you might want consider using syntax-coloring of variables and an editor which highlights/jumps-to error-lines.

UPDATE:

Did you really use strict?

Bareword "message" not allowed while "strict subs" in use at /home/lanx/tmp/tst.pl line 12.

UPDATE:

> I would have expected to be notified about the bareword.

IMHO barewords can still be lvalue-subs, where your code has perfectly legal syntax.

use strict; use warnings; use JSON; sub message :lvalue { my $a; } message = { result => JSON::false, message => "You messed up", };

runs without problems.

In your case it's a constant bareword.

Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948806]
help
Chatterbox?
[erix]: (I used http://afstandmete n.nl/ )
LanX The stations of Limburg Süd and Montabaur, which are approximately 20 km apart, ...
[LanX]: teh route I get from gmaps is 1662 km long and is crossing the Swiss Alps (mounting 2400 m) ... I wouldn't try this in December...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2017-12-13 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (369 votes). Check out past polls.

    Notices?