in reply to Re: Memory usage & hashes of lists of hashes of lists
in thread Memory usage & hashes of lists of hashes of lists
UPDATE: I added a } to properly denote the end of the foreach (@$afields) loop. It is redefined at the beginning of each ticket (foreach sort keys %tickets) {}. Sorry about the bad formatting, this is what happens when you cut and paste code. The problem is not in the $field_data (IMHO)foreach (sort keys %tickets) { my $ticket = ((split " ",$_)[0]); my %tick_inf; #hash to hold ticket info (%tick_inf = ars_GetEntry($rem,$schema,$ticket)) || warn "Could not retrieve $ticket: $ars_errstr"; #populat +e the hash with the ticket info my $field_data=$ticket; foreach (@$afield_names){ #these are the fields that we have be +en asked to grab. $field_data .= " " . $sep; #join the previous d +ata with the seperator unless (exists $hfield_names->{$_}) { print "Bad field name -- $_\n"; next; } unless (exists $tick_inf{$hfield_names->{$_}}) { print $hfield_names->{$_} . "\n"; print "Bad ticket info identifier -- $_ does not relate to +: " . $hfield_names->{$_} . "\n"; next; } unless ( defined($tick_inf{$hfield_names->{$_}})) { $field_data .= " "; next; } if (ref($tick_inf{ $hfield_names->{$_} }) eq "ARRAY") #For +array references { my $data; foreach (@{ $tick_inf{ $hfield_names->{$_} } }) #foreach o +f the values of the array ref { $data .= expand_hash($_); #it's always a hash, +so expand it out (sub returns a string) } $field_data .= $data; next; #and hit the next value } if ($d_fields->{$_}) #For dates { $field_data .= format_date( $tick_inf{ $hfield_names->{$_} } ); #format the date (sub routine) next; #and hit the next value } if ($l_fields->{$_}) #if the field is a sel +ection value { $field_data .= $l_fields->{$_}->{ #change number i +nto the name: $tick_inf{ #fill the data from the $lis +t field hash $hfield_names->{$_} # } # }; next; } $field_data .= $tick_inf{ $hfield_names->{$_} }; # #value is in the ticket }#close foreach @$fields #more stuff which gets rid of $field_data }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Memory usage & hashes of lists of hashes of lists
by dragonchild (Archbishop) on Sep 28, 2001 at 02:05 UTC | |
by the_slycer (Chaplain) on Sep 28, 2001 at 03:01 UTC | |
|
Re: Re: Re: Memory usage & hashes of lists of hashes of lists
by perrin (Chancellor) on Sep 28, 2001 at 01:44 UTC | |
|
Re: Re: Re: Memory usage & hashes of lists of hashes of lists
by runrig (Abbot) on Sep 28, 2001 at 01:58 UTC |