in reply to Re^4: Why is this auto-quoted?
in thread Why is this auto-quoted?

This could be a gotcha if you needed the + sign.

Sure, but why use the - in that case?

:) see Re: Why is this auto-quoted? (because) and perlglossary#identifier and nans, infs, and vomit

$ perl -wle " print +foo" Unquoted string "foo" may clash with future reserved word at -e line 1 +. Name "main::foo" used only once: possible typo at -e line 1. print() on unopened filehandle foo at -e line 1. $ perl -wle " print -+foo" Unquoted string "foo" may clash with future reserved word at -e line 1 +. -foo $ perl -wle " print -'+foo'" -foo $ perl -wle " print -(-foo)" +foo

Replies are listed 'Best First'.
Re^6: Why is this auto-quoted? (-(-foo))
by tobyink (Canon) on Jul 31, 2013 at 11:29 UTC

    This also works:

    $perl -wle " print - -foo " +foo

    The space between the two minus signs is significant; otherwise Perl thinks you're trying to decrement a constant.

    Also:

    $perl -wle " print -+-foo " +foo $perl -wle " print +-+-foo " +foo $perl -wle " print -+-+-foo " -foo $perl -wle " print +-+-+-foo " -foo $perl -wle " print -+-+-+-foo " +foo $perl -wle " print +-+-+-+-foo " +foo

    ...etc

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
Re^6: Why is this auto-quoted? (-(-foo))
by QM (Parson) on Jul 31, 2013 at 15:54 UTC
    Sure, but why use the - in that case?
    You may not know there is a + there, as in an eval or "$interpolation".

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      LOL Quantum