in reply to Re: Can't bless
in thread Can't bless

Thanks. the perldoc doesn't really say that clearly.

Replies are listed 'Best First'.
Re^3: Can't bless
by choroba (Cardinal) on Mar 21, 2021 at 19:07 UTC
    It's documented in perlobj to which bless links.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^3: Can't bless
by Anonymous Monk on Mar 22, 2021 at 05:08 UTC

    Hi

    Its has nothing to do with bless though, strict is protecting you from ambiguous code

    $ splain < 2 perl -c packtest.pl Bareword "PENDULUM" not allowed while "strict subs" in use at packates +t.pl line 9 (#1) (F) With "strict subs" in use, a bareword is only allowed as a subroutine identifier, in curly brackets or to the left of the "=> +" symbol. Perhaps you need to predeclare a subroutine? packtest.pl had compilation errors (#2) (F) The final summary message when a perl -c fails.

    ambiguous code (bareword PENDULUM)

    $ perl -le" print bless {}, PENDULUM; " PENDULUM=HASH(0x3f9adc) $ perl -le" sub PENDULUM { 666 } print bless {}, PENDULUM; " 666=HASH(0x3f9adc)

    See Ill-Advised Uses of Barewords in modern_perl_2016_a4.pdf page 167

      What they meant is that it's not clear from bless's docs that the second argument should be a string. Keep in mind that Perl does accept unquoted identifiers in a number of locations.

      Seeking work! You can reach me at ikegami@adaelis.com