Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: O, the horrors of references and complex data structures

by runrig (Abbot)
on Feb 06, 2001 at 01:45 UTC ( [id://56514]=note: print w/replies, xml ) Need Help??


in reply to O, the horrors of references and complex data structures

As an alternative to copying the hash every time, I'd prefer to ditch the global variable and pass a hash reference to all the subroutines (depending on the size of the hash, it could be worthwhile efficiency-wise), something like:
: while($not_done) { my %hash; sub1(\%hash); sub2(\%hash); push @AoH, \%hash; } sub sub1 { my $href=shift; $href->{key}="value"; } sub sub2 { my $href = shift; # Mess with href some more }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-19 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found