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

keys %h = 12345;?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!

Replies are listed 'Best First'.
Re: XS: The equivalent of perl's ...
by dave_the_m (Monsignor) on Aug 14, 2015 at 11:46 UTC
    The undocumented (and so probably not official API) function Perl_hv_ksplit()

    Dave.

      "The following functions have been flagged as part of the public API, but are currently undocumented. Use them at your own risk, as the interfaces are subject to change."

      I don't see a problem here, though. BrowserUk could always submit the appropriate documentation.

Re: XS: The equivalent of perl's ...
by ikegami (Patriarch) on Aug 14, 2015 at 12:27 UTC

    From mg.c, the following is the code called after the the value is assigned to the scalar returned by keys %h, sv being that scalar, and MUTABLE_HV(LvTARG(sv)) being the hash:

    Perl_magic_setnkeys(pTHX_ SV *sv, MAGIC *mg) { PERL_ARGS_ASSERT_MAGIC_SETNKEYS; PERL_UNUSED_ARG(mg); if (LvTARG(sv)) { hv_ksplit(MUTABLE_HV(LvTARG(sv)), SvIV(sv)); } return 0; }