develooper Front page | perl.perl5.porters | Postings from November 2015

Re: [perl #126715] Deprecate barewords?

Thread Previous | Thread Next
From:
Eric Brine
Date:
November 23, 2015 21:42
Subject:
Re: [perl #126715] Deprecate barewords?
Message ID:
CALJW-qFs5-GWHD4ucDhtyzjsFosMmP7oG+rO+vBZLhEnK_u0HQ@mail.gmail.com
On Mon, Nov 23, 2015 at 3:28 PM, Abigail <abigail@abigail.be> wrote:

> On Mon, Nov 23, 2015 at 01:43:05PM -0500, Eric Brine wrote:
> > On Mon, Nov 23, 2015 at 9:30 AM, Abigail <abigail@abigail.be> wrote:
> >
> > > I use
> > >
> > >     print STDERR "bla bla";
> > >
> > > quite often.
> > >
> >
> > Neither "print" nor "STDERR" are barewords in that program. A bareword is
> > an identifier treated as a string since it has no other meaning. "print"
> is
> > treated as an operator, and "STDERR" as a glob(?).
>
>
> The output of "perldoc -f print" contains the following phrase:
>
>      If you're storing handles in an array or hash, or in general
>      whenever you're using any expression more complex than a bareword
>      handle or a plain, unsubscripted scalar variable to retrieve it,
>      you will have to use a block returning the filehandle value
>      instead, in which case the LIST may not be omitted:
>
> If "STDERR" isn't a bareword, then which bareword is this phrase
> referring to?
>

It's referring to "STDERR", but STDERR is not a bareword there. "A word
that has no other interpretation in the grammar will be treated as if it
were a quoted string. These are known as 'barewords'." Bad doc.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About