Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to get two array in subroutine

by jethro (Monsignor)
on Feb 09, 2011 at 13:37 UTC ( [id://887201]=note: print w/replies, xml ) Need Help??


in reply to How to get two array in subroutine

You could add a parameter that gives the length of the first array like this:

&d(scalar(@a),@a, @b); sub d{ my ($len,@c)= @_; my @d= splice(@c,$len); ...

But you really need a good reason to do that, this is 2/3 of a bad hack. Use references (and strict and warnings, by the way)

UPDATE: Typo in the script corrected. Thanks go to CountZero for finding it

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://887201]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2024-04-18 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found