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



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
example?

....

Again, let's go back to:

C:\t> perl -w -Mstrict -e "print Does::Not::Exist, qq{\n}"
Does::Not::Exist

The comma establishes that Does::Not::Exist is not referring to
filehandle Exist in the package Does::Not.


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

Steffen

.



Relevant Pages

  • Re: Why doesnt Perl complain about this bareword?
    ... No comma allowed after filehandle at -e line 1. ... Well, it is a bareword. ... following print is to specify a filehandle in the current package. ...
    (comp.lang.perl.misc)
  • Re: Why cant print accept a comma between arguments ?
    ... consequently I have to rewrite it as: print hndw $nextline; ... First, the filehandle is optional, so if you put a comma at the beginning of the list with no filehandle would that make sense? ...
    (perl.beginners)
  • Re: match and grab
    ... print FILEHANDLE LIST ... print Prints a string or a list of strings. ... If the comma is missing then the first scalar or bareword argument is treated ... use Perl; ...
    (perl.beginners)
  • Re: Why doesnt Perl complain about this bareword?
    ... No comma allowed after filehandle at -e line 1. ... Well, it is a bareword. ... following print is to specify a filehandle in the current package. ...
    (comp.lang.perl.misc)
  • Re: regexp problem in program
    ... > # opening a filehandle for update. ... > # is to use another foreach loop to substitute a comma for white- ...
    (comp.lang.perl.misc)