in reply to passing two hashs to a subroutine

As pg said, use hash refs like so:
%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; }
See perlref.

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

    Urg, ambiuous use of %{shift}. Instead, use:

    # ... or to use as regular hashes my %genes = %{+shift}; my %codonTotal = %{+shift}; # ... or even my %genes = %{$_[0]}; my %codonTotal = %{$_[1]};

    :)