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

  • SEARCH
  • Home
  • 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 8581673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:06:34+00:00 2026-06-11T21:06:34+00:00

sub Function(\[$@%]); This works on Windows (Perl v5.14.2 on Windows 7), and accepts all

  • 0
sub Function(\[$@%]);

This works on Windows (Perl v5.14.2 on Windows 7), and accepts all 3 kinds of arguments. Hashes, Scalars and Lists.

However, the same prototype on Linux (Perl 5.6.1 on CentOS release 4.5) gives me

Malformed prototype for main::Function: \[%@$].

On both, I am doing use 5.006.
And otherwise, the scripts are exactly identical.

  • 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-06-11T21:06:36+00:00Added an answer on June 11, 2026 at 9:06 pm

    That prototype didn’t exist back in 5.6.1. It’s a recent addition as it was added in 5.14. (That means it’s in all supported versions of Perl.)

    You can’t pass an array or a hash to a sub, only a list of scalars. The prototype is causing the calling code to take a reference and pass that. That’s something you can do explicitly by changing

    sub Function(\[$@%]) { }
    Function($s);
    Function(@a);
    Function(%h);
    

    to

    sub Function { }
    Function(\$s)
    Function(\@a)
    Function(\%h)
    

    Prototypes are generally to be avoided anyway.

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

Sidebar

Related Questions

How do you translate this perl subroutine into a PHP function? sub disagreement {
This is the code: sub function($&) { my $param1 = shift; my $code =
I have this function in my generator. Private Sub AddBoundedValue(ByVal boundedValue As Object, ByVal
I found a function on the web that generates all sub-multisets of a set
I'm trying to watch a directory for changes using the FindFirstChangeNotification function. This works
This sub works fine: Private Sub UpdateInfo(ByVal text As String, ByVal timeStamp As DateTime)
This is Peter Higgins's pub sub library: https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js (function (d) { var cache =
Is it possible to access outer local varialbe in a PHP sub-function? In below
I have an application in vb.net that starts with a sub function do some
Splitting up functions, into smaller sub function into the code, can effect efficiency of

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.