sub count_orientation { my $ref = shift; my $x = shift; my $y = shift; $x->{$ref}{amount}++; if ($y->{$ref}{orientation} eq "for"){ $x->{$ref}{amountFor}++; } else { $x->{$ref}{amountRev}++; } } &count_orientation ($ref_end, \%error_start, \%score);