%var - Hash
$var{$key} - Hash element
$var - Scalar. No relation to %var
####
return &Y::module_subroutine($hash_to_send);
sub module_subroutine {
my($hash) = @_;
return "The colour of the sky is ".
$hash{third_colour};
}
####
return &Y::module_subroutine(%hash_to_send); <--- Use the right var
sub module_subroutine {
my(%hash) = @_; <--- Use the right type
return "The colour of the sky is ".
$hash{third_colour};
}
####
return &Y::module_subroutine(\%hash_to_send); <--- Pass reference
sub module_subroutine {
my($hash) = @_; <--- A ref to a hash
return "The colour of the sky is ".
$hash->{third_colour}; <--- Must dereference
}