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.


In reply to Re: Array troubles.. (Making a three-way method..) by Baboon
in thread Array troubles.. (Making a three-way method..) by dargosch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.