http://www.perlmonks.org?node_id=948806


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