On Thu, 8 Nov 2001, Lisa Neclos wrote:

> 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

You need to dereference the reference:

while(my($key, $val) = each(%{$ref_hash})) {

-- Brett

------------------------------------------------------------------------
Every nonzero finite dimensional inner product space has an orthonormal basis.

It makes sense, when you don't think about it.


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

Reply via email to