in reply to The purpose of prototypes in perl subroutines

Prototyping has a use when running with the strict 'subs' pragma. While it is in effect, you will have to prototype your subs to use the bareword style when calling:
sub mysub; print mysub;
or, use the ampersand or parens:
print mysub();
*** Special thanks to Nat Torkington. I've been reading Jon Orwant's Computer Science and Perl Programming book lately. Good information, and a good review of perl topics you may have forgotten. Pick it up if you don't have it.
J. J. Horner 
CISSP,CCNA,CHSS,CHP,blah,blah,blah

Replies are listed 'Best First'.
Re^2: The purpose of prototypes in perl subroutines
by Joost (Canon) on Apr 13, 2005 at 15:31 UTC
    That's not prototyping: that's just predeclaring that the subroutine mysub exists. You're explicitly not specifying a prototype there.

    You can call any subroutine without parentheses as long as it's been "seen" before:

    #!/usr/local/bin/perl -w use strict; sub bla { print "Bla!\n"; } bla;
    update: Ironically, a nice way to make the above fail is to use a (wrong) protoype:
    #!/usr/local/bin/perl -w use strict; sub bla($) { print "Bla!\n"; } bla; __END__ syntax error at test.pl line 8, near "bla;" Execution of test.pl aborted due to compilation errors.
      It is the same thing. Ask Nat Torkington, as that is what he calls it. Probably pure semantics, but either way, it is considered prototyping.
      J. J. Horner 
      CISSP,CCNA,CHSS,CHP,blah,blah,blah
      

        Just because someone says something doesn't make it true. This isn't just semantics, either.

        Perhaps you give us the reference where you found Nat talking about this sort of prototype (article name or page number would work). IF you are talking about the "Cryptocontext" article, I think you've misunderstood something.

        --
        brian d foy <brian@stonehenge.com>