#The code not working my ($common_ref, $total_ref) = calc_enthalpy (\%hash, \%enthalpy_hash); @total = @$total_ref; @common = @$common_ref; print "TEST: @total @common
";
sub calc_enthalpy {
my ($hash, $enthalpy_hash) = @_;
my (@common, @total);
foreach (keys %enthalpy_hash) {
if (exists $hash{$_}) {
push @common, "$_ = ", $enthalpy_hash{$_} * $hash{$_}, "\n";
push @total, $enthalpy_hash{$_} * $hash{$_}, "\n";
}
return (\@common, \@total);
}
}
####
foreach (keys %enthalpy_hash) {
if (exists $hash{$_}) {
push @common, "$_ = ", $enthalpy_hash{$_} * $hash{$_}, "\n";
push @total, $enthalpy_hash{$_} * $hash{$_}, "\n";
}
# etc
}