Re: Why doesn't Perl complain about this bareword?

sheinrich@xxxxxxxxxxx wrote in news:41f43d75-d4cb-4633-95a9-

On May 7, 1:45 pm, "A. Sinan Unur" <1...@xxxxxxxxxxxxxxxxxxx> wrote:

Note the following cases:

C:\t> perl -w -Mstrict -e "print Does,Not,Exist, qq{\n}"
No comma allowed after filehandle at -e line 1.

In this case, Does has a valid interpretation as a
bareword filehandle. Thus, strict does not kick in.

But why is the first argument being taken here for a filehandle, in
spite of the comma, and not considered as namespace, as in your other

Well, it is a bareword. The most natural use of a bareword found
following print is to specify a filehandle in the current package.

The alternative to giving an error message would have been to print Does
which is not what the programmer wanted in 99.9999% of cases of a
bareword following a print followed by a comma.

It seems like only Strings containing :: (or ' ) qualify as possible
package names.

No. DoESnoTExiST is also a valid package name. However, only ' and ::
can be used as separators in a package name.


A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW: