in reply to Reference found where even-sized list expected

The ref isn't the problem. The problem is the curly braces, which create an anon hash reference; then you try to assign that to the %defaults hash. So you're assigning a reference, where an even-sized list (a list of key-value pairs) was expected. Hence the error message.

Change that line to this:

my %defaults = ref( $_[2+$[] ) ? %{$_[2+$[]} : ();

Replies are listed 'Best First'.
RE: Re: Reference found where even-sized list expected
by Adam (Vicar) on Sep 13, 2000 at 23:57 UTC
    Oh!!! ++ for btrott and jcwren

    Once again I fail to understand why someone would down vote a simple node like this one, which was merely posted to say, "Thank you for spotting that which I didn't." After all, isn't that what this site is about? I come here and answer other people's questions, why should I get down voted when I have a question and then take the time to thank the people that spotted the mistake? We all make mistakes. Even the saints and gurus amongst us.