I am not sure if this should go in Q&A or here, but... anyway...if i have one subroutine that calls another subroutine, should i pass a value to sub one by reference, and then to sub two by reference again, or should i pass a value to sub one by reference and then to sub two straight? right now it works passing by reference twice, but it is kinda ugly...
%hash = (
"j" = "jack",
"q" = "queen",
"k" = "king",
"a" = "ace"
);
one( \%hash);
sub one {
my ($hash) = @_;
if ( <STDIN> eq "hello\n" ) {
two( \%$hash); # should this be two( $hash ); ?
}
}
sub two {
my ($hash) = @_;
foreach ( keys %$hash ) {
print "$_\n";
}
}