Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 411023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:56:45+00:00 2026-05-12T17:56:45+00:00

What syntax, if any, is able to take a reference of a builtin like

  • 0

What syntax, if any, is able to take a reference of a builtin like shift?

$shift_ref = $your_magic_syntax_here;

The same way you could to a user defined sub:

sub test { ... }

$test_ref = \&test;

I’ve tried the following, which all don’t work:

\&shift
\&CORE::shift
\&{'shift'}
\&{'CORE::shift'}

Your answer can include XS if needed, but I’d prefer not.

Clarification: I am looking for a general purpose solution that can obtain a fully functional code reference from any builtin. This coderef could then be passed to any higher order function, just like a reference to a user defined sub. It seems to be the consensus so far that this is not possible, anyone care to disagree?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:56:46+00:00Added an answer on May 12, 2026 at 5:56 pm

    No, you can’t. What is the underlying problem you are trying to solve? There may be some way to do whatever that is.

    Re the added part of the question “Your answer can include XS if needed, but I’d prefer not.”,
    calling builtins from XS is really hard, since the builtins are set up to assume they are running as part of a compiled optree and have some global variables set. Usually it’s much easier to call some underlying function that the builtin itself uses, though there isn’t always such a function, so you see things like:

    buffer = sv_2mortal(newSVpvf("(caller(%d))[3]", (int) frame));
    caller = eval_pv(SvPV_nolen(buffer), 1);
    

    (doing a string eval from XS rather than go through the hoops required to directly call pp_caller).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any wiki syntax like rdoc, markdown, ... recommended in the ruby world?
Is there any short syntax for if-else statement in objective C like PHP: if($value)
Is there any way I can get my Python code syntax highlighted in Microsoft
I want a user to be able to access objects (could be JSON or
I want to be able to take any arbitrary SELECT TOP(X) query that would
Does the SQL syntax differ in any way for SQL Plus and apex.oracle.com From
Does anyone know of any C# syntax highlighter plugins for Confluence? Using the default
I use the rails 3.0.0.beta Is there any new syntax to write RJS, here
Are there any Drupal IDE's with syntax highlighting, and possibly intellisense, function descriptors?
Is there any framework for querying XML SQL Syntax, I seriously tire of iterating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.