Funny you should pick grep as your example of a function because there is no grep function anywhere. It's gets compiled into the grepstart and grepwhile opcodes. You'll find that none of the named operators are compiled into function calls. They are typically compiled into opcodes which the same name as the function or operator.

$ perl -MO=Concise,-exec -e'time();' 1 <0> enter 2 <;> nextstate(main 1 -e:1) v:{ 3 <0> time[t1] v 4 <@> leave[1 ref] vKP/REFC -e syntax OK

As a function call, it would look like:

$ perl -MO=Concise,-exec -e'timex();' 1 <0> enter 2 <;> nextstate(main 1 -e:1) v:{ 3 <0> pushmark s 4 <$> gv(*timex) s/EARLYCV 5 <1> entersub[t1] vKS/TARG,1 6 <@> leave[1 ref] vKP/REFC -e syntax OK

The point is that there's really no difference between grep, eq and the rest of perlfunc and perlop except for perceived differences. There's a set you perceive as functions, and that's exactly what I said earlier.

maybe "my" is something else, for me it belongs in the same class as "sub",

Well, I was saying that when my looks like a function, you shouldn't be surprised that my acts like a function. sub doesn't really look like a function.

I don't know what this class is you are defining, nor how it relates to this conversation.

Keyword?

Yes, "my" is a keyword. It's quite a vague description, though.

perlsyn uses the term "statement".

While my $x would be a statement, my is not a statement itself.


In reply to Re^11: why doesn't "my ($a,$b)" return a list? by ikegami
in thread why doesn't "my ($a,$b)" return a list? by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.