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 379629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:54:36+00:00 2026-05-12T14:54:36+00:00

We should all be familiar with the problems related to prototypes in Perl. Here

  • 0

We should all be familiar with the problems related to prototypes in Perl. Here are the two biggies:

  • they don’t work like prototypes in other languages, so people misunderstand them.
  • they don’t apply to all ways of calling a subroutine.

The second item is the one I am curious about at the moment.

I know of two ways to subvert/work around/ignore prototype enforcement when calling a subroutine:

  • Call the sub as a method. Foo->subroutine_name();
  • Call the sub with a leading & sigil. &subroutine_name();

Are there any other interesting cases I’ve missed?

Udpate:

@brian d foy, I don’t particularly want to evade prototypes, but I wondered “how many ways are there to do it?” I ask this question out of curiosity.

@jrockway, I agree with you, and I believe that you have more explicitly and more concisely described my first point regarding the problems with prototypes, that people misunderstand them. Perhaps the problem lies in programmer expectations and not in the feature. But that is really a philosophical question of the sort I don’t want to have.

  • 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-12T14:54:37+00:00Added an answer on May 12, 2026 at 2:54 pm

    Call it via a subroutine reference.

    sub foo($) { print "arg is $_[0]\n" }
    my $sub = \&foo;
    $sub->();
    

    Call it before Perl has seen the prototype (important because perl doesn’t make you declare subs before use):

    foo();
    sub foo($) { print "arg is $_[0]\n" }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To give you an example that you all should be familiar with, imagine that
I'm trying to write correct intent filter. I'm basically familiar with intents, they work
Should all structs and classes be declared in the header file? If I declare
Should all linq queries which return an entity be surrounded with a try catch?
I have a few links that should all open in the same window or
When you log out of a web app, should ALL your session be logged
As Jeff Atwood asked : "What’s your logging philosophy? Should all code be littered
The script below should open all the files inside the folder 'pruebaba' recursively but
I know that I should put all the html elements in body tag, but
Running a query which should return all open questions along with the last update

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.