Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: passing paramters to a sub

by Roger (Parson)
on Aug 30, 2005 at 09:18 UTC ( #487682=note: print w/replies, xml ) Need Help??


in reply to passing paramters to a sub

Other monks have already pointed you in the right direction with passing structures by reference.

I just want to point out that it is possible not to pass by reference for your benefit.

A simple hash basically has keys and corresponding values. Knowning this, you can write your code like this:
whatever(%hash, $val) ... sub whatever { my $v = pop; my %h = @_; # %hash was expanded into list of key-value pairs # reconstruct hash from array of key-value pairs ... }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://487682]
help
Chatterbox?
[jedikaiti]: Yea, the kids (& the cats) are good at that
talexb is having a hard time with Windows losing DNS info for Perlmonks when voting. CB works fine. Ugh.
[jedikaiti]: how odd

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2017-07-25 15:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (374 votes). Check out past polls.