I may be missing the point here...
Since you seem to be using global variables anyway, you don't need to even return anything from build_list.
You are passing in references to hashes. Those hashes are being modified by build_list. Your assignment to the hashes from the return value of build_list is redundant. They are already modified when build_list returns. Just use %RECORDxRI_count and %EACH_RECORD.
I assume you are doing more in build_list and the <DATA> loop than you actually posted...
Here is some condensed code (since you expressed interest in minimizing lines of code):
Notes:my %RECORDxRI_count; my %EACH_RECORD; sub build_list { my( $RECORD, $RI, $RECORDxRI, $RECORDxRI_count_REF, $EACH_RECORD_REF + ) = @_; $RECORDxRI_count_REF->{$RECORDxRI}++; $EACH_RECORD_REF->{$RECORD} = ''; } while <DATA> { my( $Record54, $Record38 ) = (split /\t/)[54, 38]; my $RECORD = (split /{/, $Record54)[0]; $RECORDxRI = $RECORD . ',' . $Record38; build_list( $RECORD, $RI, $RECORDxRI, \%$RECORDxRI_count, \%EACH_REC +ORD ); }
Hope this is helpful...
Russ
In reply to Re: defining a HASH table by reference and using it in a sub function
by Russ
in thread defining a HASH table by reference and using it in a sub function
by Buckaroo Buddha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |