RaFaL has answered the question you asked, but it should be mentioned that
you are not using symbolic references in your code.  \%hash is a hard
reference.


On Thu, Oct 18, 2001 at 09:33:06AM -0400, Ross Howard wrote:
> populate_hash (\%hash1, "HEY1", "value1");
> populate_hash (\%hash2, "HUMM", "HAH");

[snip]

> sub populate_hash ($$\%) {
>       my $hash = $_[0];
>       my $key = $_[1];
>       my $value = $_[2];
> 
>       ${%{$hash}}{$key} = $value;
> }

The prototype ($$\%) dictates the subroutine gets three arguments: a scalar,
a scalar, and a hash that is enreferenced.  Your example calls, however,
are: hash reference (which is a scalar), scalar, scalar.  The only thing
preventing this from becoming a fatal error is that your prototype is
declared too late, which perl warns you about if you have warnings turned
on.

Perhaps you meant:

    sub populate_hash (\%$$);

    populate_hash(%hash1, "HEY1", "value1");
    populate_hash(%hash2, "HUMM", "HAH);

    sub populate_hash (\%$$) { 
        ...
    }


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to