Why don't you just always treat them as references? Then you won't have to reference/dereference them each time.
Read perlref if this doesn't make sense.# Define them as hash references. my $RECORDxRI_count_REF = {}; my $EACH_RECORD_REF = {}; while (<DATA>) { .... # Call build list--now you don't need to # take references to the hashes, because they're # already references build_list( $RECORD, $RI, $RECORDxRI, $RECORDxRI_count_REF, $EACH_ +RECORD_REF ); .... } sub build_list { my( $RECORD, $RI, $RECORDxRI, $RECORDxRI_count_REF, $EACH_RECORD_R +EF ) = @_; # These are hash references. To access them, # you *don't* need to assign them to hashes. # Just use the -> operator, which automatically # dereferences them. $RECORDxRI_count->{$RECORDxRI}++; $EACH_RECORD->{$RECORD} = ''; }
In reply to Re: defining a HASH table by reference and using it in a sub function
by btrott
in thread defining a HASH table by reference and using it in a sub function
by Buckaroo Buddha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |