Sorry it took so long to reply Sean. I tried my best to get through this
in the morning, but I hadn't had my coffee yet. Then, I got involved in
work, and forgot about it.
On 09 Jul 2001 10:43:52 -0400, Sean Quinlan wrote:
> The error was odd number of elements assigned...?! OK, so I threw in the warn,
> which indicated that @_ contained excactly what I expected; DEBUG and 2. Well,
> after thrashing and skimming some docs for a while without result, I started up
> an email. For some reason, maybe the lack of pretty print and syntax
> highlighting, I started wondering about precidence in @_ || (); So I switched
> the problem line to:
> my %params = @_ or ();
I don't think you really solved the problem you were trying to solve
here. Really, you have introduced an error.
|| evaluates its left argument as a scalar. So really, your code was
being evaluated as:
my %params = scalar(@_) || ();
scalar(@_) was evaluating to 2.
you were effectively saying my %params = 2.
Which is clearly not what you intended.
So, what did your "fix" do?
my %params = @_ or ();
Well, or has a higher precedence than assignment. Which means now you
are saying:
(my %params = @_) or ();
Sure, it works for you when @_ contains something, but it's not really
doing exactly what you want. (Okay, technically it DWYM because %params
is empty anyways, but ignore that for the sake of letting me finish.
Imagine () is some list that you really wanted it to default to, like
('foo', 'bar')).
What you really wanted would have been:
my %params = @_ ? @_ : ();
Which, while ugly, should give you the default values if you had done
something other than ().
> problem. The return from that routine was:
> return($self,$AR_seqs,$return_type,%params);
To my eyes, this appears that it should work. Guess I'll have to leave
this one for someone else.
Christopher