[Pdx-pm] Instance hash ( keyed array )

Roderick A. Anderson raanders at acm.org
Tue Oct 17 13:32:37 PDT 2006


I'm working on a module [0] that needs to do something I have not seen 
in any other module or documentation.  It may be my ignorance that is 
making this complicated.

I need to build a, sometimes, quite large hash table ( 40,000 - 470,000 
records ) one record at a time.  The method will return the key it is 
used to the caller so it can be used to key the rest of the data not 
passed in to the method.

Here is the sub.

sub add_addr {

     my $self = shift;
     my @stuff = @_;

     my $recid = $self->inc_recid();
     my $addr = join( $FldDelim, $recid, @stuff );
     $addr .= $RcdDelim;

     $self->{addr_data}->{$recid} = $addr;

     return $recid;
}

Is there a better way to do this?

[0] actually re-working a script into a module.


Thanks for any insights or ideas,
Rod
-- 


More information about the Pdx-pm-list mailing list