in reply to passing two hashs to a subroutine
See perlref.%majCodon = calMajCodon(\%genes, \%codonTotal); sub calMajCodon { # To just use the hash refs (and save memory) ... my ($genes, $codonTotal) = @_; print $codonTotal->{startCodon}; # ... or to use as regular hashes. my %genes = %{$_[0]}; my %codonTotal = %{$_[1]}; print $codonTotal{startCodon}; # And to return a hash... return %majCodons; }
Update Fixed ambiguous use of shift as pointed out by the anony monk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: passing two hashs to a subroutine
by Anonymous Monk on Oct 18, 2003 at 18:11 UTC |