in reply to use constant usage clarification

[this]' gives a scalar assignment error use constant x = 1/3

Really? Cos when I try it, the error is: Unquoted string "x" may clash with future reserved word.

Care to post a short script that produces that error when run?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: use constant usage clarification
by Discipulus (Canon) on Oct 31, 2014 at 08:45 UTC
    Hello BrowserUK i'm receiving too an assignement error using the wrong syntax with the not stringified left value:
    #(something like:) perl -MConfig -e "BEGIN{print 'Perl ', map {$Config{$_},' '}qw/version + os archname/ }; use constant X = 1/3;print qq(\n),+X,qq(\n)" ----------------------------------------······· | Can't modify constant item in scalar assignment at -e line 1, near +"3;" | BEGIN not safe after errors--compilation aborted at -e line 1. | Perl 5.14.2 MSWin32-x86-multi-thread -------------------------------------------------------------------- +---······· ----------------------------------------······· | Can't modify constant item in scalar assignment at -e line 1, near +"3;" | BEGIN not safe after errors--compilation aborted at -e line 1. | Perl 5.20.0 MSWin32-x86-multi-thread-64int -------------------------------------------------------------------- +---······· ----------------------------------------······· | Can't modify constant item in scalar assignment at -e line 1, near +"3;" | BEGIN not safe after errors--compilation aborted at -e line 1. | Perl 5.16.2 MSWin32-x64-multi-thread -------------------------------------------------------------------- +---·······

    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.