I am getting the following error when trying to run this.  I'm trying to
pass a hash as a reference to the subroutine.

ERROR - Type of Arg 1 to each must be hash (not private variable)

my $ref_hash ;
%hash = ("sky", "blue", "grass", "green", "apple", "red") ;
$ref_hash = \%hash ;

sub print {
while (my($key, $val) = each($ref_hash)) {  #while hash has another
value
        print("$key ==> $val\n");     # print the value
}
}
exit 0 ;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to