Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Preserving hash structure after subroutine call

by artist (Parson)
on May 13, 2003 at 21:09 UTC ( [id://257900]=note: print w/replies, xml ) Need Help??


in reply to Preserving hash structure after subroutine call

May be you can follow this simple example and try modifying to see where you are getting the problem:
use Data::Dumper; my %myhash = {}; build_hash(\%myhash); print Dumper(\%myhash); sub build_hash { my $href = shift; my %results = (1,2,3,4);; %{$href} = %results; # print Dumper($href); }

artist

Replies are listed 'Best First'.
Re: Re: Preserving hash structure after subroutine call
by Anonymous Monk on May 13, 2003 at 21:38 UTC
    I've used the method in your example extensively to initialise hashes and never had any problem with it. For some reason (scope?) it just doesn't seem to work when the fetchrow_hashref method is involved.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-25 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found