You get two difference addresses because you take create references to two different subs, &main::stat and &CORE::stat.


First, you take the address of &main::stat. It's never defined.

$ perl -e'my $sub = \&stat; $sub->("a")' Undefined subroutine &main::stat called at -e line 1.

Then, you take the address of &CORE::stat twice. The subs in CORE:: are automatically-generated wrappers for the operators of the same name, so you get a wrapper to the stat operator.

$ perl -e'my $sub = \&CORE::stat; $sub->("a")' &CORE::stat cannot be called directly at -e line 1.

Well, it would be if stat had a calling convention that could be duplicated by subroutine prototypes. Instead, it's a wrapper for an error message.


In reply to Re: CORE::stat() doesn't appear to be the same as stat by ikegami
in thread SOLVED: CORE::stat() doesn't appear to be the same as stat by Bloodnok

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.