in reply to strict subs and bareword exceptions


I guess that in the second example the bareword isn't rejected by strict because it looks like a filehandle. The same bareword throws an error if its position is changed:
# Program Output Deparse perl -Mstrict -le 'print nono . "1" ' # nono1 # print 'nono' . ' +1'; perl -Mstrict -le 'print "1" . nono ' # (error) #

Unrelated to this, the following seems a little odd:

# Program Output Deparse perl -Mstrict -le 'print nono . '1' ' # nono1 # print 'nono' . 1 +; perl -Mstrict -le 'print nono .'1' ' # (nothing) # print nono 0.1;

--
John.

Replies are listed 'Best First'.
Re: Re: strict subs and bareword exceptions
by blakem (Monsignor) on Feb 22, 2002 at 10:10 UTC
    The odd one-liners might be due to shell quoting... Can you get the same deparsed output with a regular script?
    $ perl -Mstrict -MO=Deparse -le 'print nono .'1' ' print nono 0.1; $ echo "print nono .'1' " > oneliner $ perl -Mstrict -MO=Deparse -l oneliner print 'nono' . '1';

    -Blake


      You're right. It is the shell. :-)

      --
      John. "Aaargh. The shells, the shells!"