in reply to 'print' puzzle

...or you could just stop putting spaces between your subroutine name and the open paren. This is suggested by "perldoc perlstyle" and will also, as you've found, make you code less likely to be parsed in a way other than you wanted.

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

Replies are listed 'Best First'.
Re: (tye)Re: 'print' puzzle
by John M. Dlugosz (Monsignor) on Nov 13, 2001 at 00:14 UTC
    Care to elaborate on that?

      #!/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.