How do I do this in one line?
sub build_list {
($RECORD,$RI,$RECORDxRI,$RECORDxRI_count_REF,$EACH_RECORD_REF) = @
+_;
%RECORDxRI_count = %$RECORDxRI_count_REF;
%EACH_RECORD = %$EACH_RECORD_REF;
$RECORDxRI_count{$RECORDxRI}++;
$EACH_RECORD{$RECORD} = '';
return(\%RECORDxRI_count,\%EACH_RECORD);
}
while <DATA> {
@record = split('\t',$_);
$RI = @record[38];
($RECORD,$junk) = split('{',@record[54]);
$RECORDxRI = $RECORD . ',' . $RI;
($RECORDxRI_count_REF,$EACH_RECORD_REF) = &build_list($RECORD,$RI,
+$RECORDxRI,\%$RECORDxRI_count,\%EACH_RECORD);
%RECORDxRI_count = %RECORDxRI_count_REF;
%EACH_RECORD = %$EACH_RECORD_REF;
# NOTE: I have to dereference both hashes
# on every iteration of the while loop
} # end while data
OK ... I understand that ONE line is a little overzealous,
but I'm actually interested in making the function call
to &build_list in one line...
Is there a way to get a full hash without
dereferencing the hashes I pass to the routine on
every iteration of this loop?
Could I get
&build_list(\%hash1,\%hash2);
to create that hash on its first pass and on
subsequent iterations of "while" use the same hash?