in reply to Hash reference as a parameter
Here is an example. You pass the parmeter as a hash reference and access it as a hash reference in the function.
func({1=>'a', 2=>'a', 'a'=>99, 'f'=>'234', 'xyzzy'=>'Grue be here.', 'foo'=>'geww',}); sub func { my $hashref = shift; print "an item from hash: $hashref->{'xyzzy'}\n"; printf("another item from hash: %s\n", $hashref->{'foo'}); }
Hazah! I'm Employed!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash reference as a parameter
by InfiniteSilence (Curate) on Sep 12, 2005 at 20:49 UTC | |
|
Re^2: Hash reference as a parameter
by ramya2005 (Scribe) on Sep 12, 2005 at 20:34 UTC | |
by osunderdog (Deacon) on Sep 12, 2005 at 20:48 UTC | |
by ramya2005 (Scribe) on Sep 12, 2005 at 20:57 UTC |