dbs has asked for the wisdom of the Perl Monks concerning the following question:

perl -le 'print prototype "CORE::open"' perl -le 'print prototype "CORE::close''
why is it useful and in what context? thx!

Replies are listed 'Best First'.
Re: what does its output mean...whats it do?
by toolic (Bishop) on Jun 23, 2011 at 17:18 UTC
Re: what does its output mean...whats it do?
by Marshall (Canon) on Jun 23, 2011 at 19:35 UTC
    why is it useful? If you have actually run the commands, you will see yourself that the output is not that useful! If you want to learn how a function is called, you are far better off looking at the man or perldoc pages.

    Function prototypes can be used to mimic a built-in function and allow the omission of parens. When first learning Perl, I though oh, how cool. As it turns out, this isn't cool - its a bad idea. Perl is so loosely typed that you just don't gain much in the way of argument checking. And because the prototype has to be seen before you make a call to that function, you wind up either placing the subs before main, or putting a duplicate prototype definition before main. This is a hassle. Perl is already very loose about allowing the omission of paren's, some would argue too loose! Having to use parens when calling your own functions as opposed to a built-in is no big deal.

    I would recommend that you stay away from prototypes - I think most folks would too.