Re: Why doesn't Perl complain about this bareword?
- From: "A. Sinan Unur" <1usa@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 07 May 2008 19:21:24 GMT
sheinrich@xxxxxxxxxxx wrote in news:41f43d75-d4cb-4633-95a9-
e5b76af6a97c@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:
On May 7, 1:45 pm, "A. Sinan Unur" <1...@xxxxxxxxxxxxxxxxxxx> wrote:
...
Note the following cases:But why is the first argument being taken here for a filehandle, in
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.
spite of the comma, and not considered as namespace, as in your other
example?
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.
Sinan
--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
.
- Follow-Ups:
- Re: Why doesn't Perl complain about this bareword?
- From: sheinrich
- Re: Why doesn't Perl complain about this bareword?
- References:
- Why doesn't Perl complain about this bareword?
- From: Ronny
- Re: Why doesn't Perl complain about this bareword?
- From: Ben Bullock
- Re: Why doesn't Perl complain about this bareword?
- From: sheinrich
- Re: Why doesn't Perl complain about this bareword?
- From: A. Sinan Unur
- Re: Why doesn't Perl complain about this bareword?
- From: sheinrich
- Why doesn't Perl complain about this bareword?
- Prev by Date: FAQ 3.25 Where can I learn about CGI or Web programming in Perl?
- Next by Date: Re: 2 simple questions
- Previous by thread: Re: Why doesn't Perl complain about this bareword?
- Next by thread: Re: Why doesn't Perl complain about this bareword?
- Index(es):
Relevant Pages
|