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