Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How to get two array in subroutine

by andreas1234567 (Vicar)
on Feb 09, 2011 at 13:20 UTC ( #887191=note: print w/ replies, xml ) Need Help??


in reply to How to get two array in subroutine

You need to use references. See example here:

(@listc, @listd) = simplesort(\@lista, \@listb); sub simplesort { my ($listaref, $listbref ) = @_; # De-reference the array list my (@lista) = @$listaref; my (@listb) = @$listbref; # Now you can play with both arrays. }
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]


Comment on Re: How to get two array in subroutine
Download Code
Replies are listed 'Best First'.
Re^2: How to get two array in subroutine
by Anonymous Monk on Feb 09, 2011 at 13:26 UTC
    I mentioned without references.
      Just use references. Oh, and tell the interviewer its a stupid question.

      Thanks Sir.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2015-07-30 04:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls