in reply to (tye)Re: 'print' puzzle
in thread 'print' puzzle

Care to elaborate on that?

Replies are listed 'Best First'.
(tye)Re2: 'print' puzzle
by tye (Sage) on Nov 13, 2001 at 01:43 UTC

    #!/usr/bin/perl -w print bareword ("parens"); print bareword( "parens" ); __END__ Unquoted string "bareword" may clash with future reserved word at line 3. Filehandle main::bareword never opened at line 3. Undefined subroutine &main::bareword called at line 4.
    Your style choice causes the line to be parsed differently. That style choice used to break even more things but it was determined that "we" should try to support it even though it is generally not liked for use with Perl. Unless you really enjoy finding bugs and quirks in the Perl parser, you should probably just avoid using that particular style.

            - tye (but my friends call me "Tye")
      I've never heard of that. Perhaps it should be in perltrap.

      perldoc says "No space between function name and its opening parenthesis." under "he (Larry) has other preferences that aren't so strong". So it's not a warning at all, but a style preference with no further explaination.

        Elsewhere you mention the "if it looks like a function" rule. That was created when it was figured out that putting a space between "print" and "(" sometimes got a different interpretation from "print(". At the time this was discovered, I recalled the mood of the discussion being somewhat "well, that code is ugly, but not so ugly that it should break things so we should probably fix it".

        So we have multiple bugs associated with this style. It isn't widely used (otherwise these bugs would have been found sooner) and isn't widely tested. My suggestion is to not use it.

                - tye (but my friends call me "Tye")