Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Help with storing data in a hash

by hallikpapa (Scribe)
on Jan 28, 2008 at 22:26 UTC ( [id://664797]=note: print w/replies, xml ) Need Help??


in reply to Re: Help with storing data in a hash
in thread Help with storing data in a hash

Well here's the dates:
my @dates = ( '20080101', '20080102', '20080103', '20080104', '20080105', '20080 +106', '20080107', '20080108', '20080109', '20080110' );
And for this specific procedure, it only wants one day. way the store procedure in the db is.
foreach my $d (@dates) { %calls = &call_type( $d, $d ); } print Dumper \%calls;
I followed your second suggestion and that worked. I appreciate the help.

Replies are listed 'Best First'.
Re^3: Help with storing data in a hash
by samtregar (Abbot) on Jan 28, 2008 at 22:28 UTC
    Aha - that's the important part! You're overwriting %calls each time you call that function. I added an example you can use to my answer above. A better solution would be to make call_type() accept a reference to %calls and add entries to it.

    -sam

Re^3: Help with storing data in a hash
by Punitha (Priest) on Jan 29, 2008 at 04:44 UTC

    Hi hallikpapa

    You simply declare %calls in outside of the subroutine call_type like

    my %calls; foreach my $d (@dates) { %calls = &call_type( $d, $d ); }

    Punitha

Log In?
Username:
Password:

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

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

    No recent polls found