in reply to Array troubles.. (Making a three-way method..)

While your code needs some improvements, I see an error here, which will be revealed using "use strict;" and "use warnings;" (or better yet just run your code using '-w' switch).

I mean your lines

my $out = @@{$self->{'labels'}}?$#{$self->{'labels'}}:0; return DVAL $out;
Write them as just:
return scalar @{$self->{'labels'}};
Your more calculations are:
1. wrong, because $#blabla returns -1 if no members in @blabla and your code needs at least adding '1' to it
2. wrong, because your @@{blabla} will do nothing usefull at all (as I see it)

Anyway, you seem to be lost and you need to rethink your idea and implementation, may be re-ask your question from other point.

Personally, I advice you:
1. Do not "use Carp::Datum" right now, because you should start with more obvious debugging techniques, such as using "use Data::Dumper" and just printing your debug values to STDERR, or may be "ptkdb" graphical debugger will greatly help.
2. do not use such many temporary variables, when you can easily use function return value directly (as with "$inRef" variable)

Best wishes,
I.R.Baboon.