http://qs321.pair.com?node_id=11121013


in reply to Re^2: My problems to understand the Perl documentation
in thread My problems to understand the Perl documentation

My conclusion from this is that split is a Perl sub, without prototype.

Is there any built-in without a prototype? I don't think so.

Greetings,
-jo

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
  • Comment on Re^3: My problems to understand the Perl documentation

Replies are listed 'Best First'.
Re^4: My problems to understand the Perl documentation
by LanX (Saint) on Aug 23, 2020 at 21:52 UTC
    > Is there any built-in without a prototype? I don't think so.

    Yes, several.

    You can check yourself with prototype

    From the docs:

    If FUNCTION is a string starting with CORE:: , the rest is taken as a name for a Perl builtin.

    If the builtin's arguments cannot be adequately expressed by a prototype (such as system), prototype returns undef, because the builtin does not really behave like a Perl function.

    Otherwise, the string describing the equivalent prototype is returned.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re^4: My problems to understand the Perl documentation
by haukex (Archbishop) on Aug 24, 2020 at 07:31 UTC
    Is there any built-in without a prototype?

    On 5.28, prototype returns undef for at least the following (I may have missed a few, and I omitted most things that I think most people would classify as keywords and operators instead of functions, like use, goto, and -X):

    chomp chop defined delete do eval exec exists grep map print printf require return say select sort split system

    Added minor clarifications.

      > most people would classify as keywords and operators instead of functions

      For me any reserved word is a keyword, this includes functions.

      I know what you mean but "keyword" doesn't describe it.

      See also perlfunc#Perl-Functions-by-Category ... which is even more confusing.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        Yes, good point, I was thinking of e.g. if and for, but I didn't list goto but did list return - now that I think about it some more, I probably shouldn't have listed the latter because it can't really be approximated by a sub (that's how I personally generally differentiate between "functions" and "operators" in Perl, but this isn't perfect and a pretty big grey area).