Hi

note: the following is not intended to be a fix to your program; instead I try to show you a few steps you could have done to identify faulty/suspicious parts of your program...

First, you have not followed the golden rule to

use strict; use warnings;
Then you would have found out some obvious mistakes like
for (@myarray1) { last if $conf eq $_; $i++; };
Secondly, you use debug-output, which is fine ... however it is not detailed enough; e.g.
print "Values is @values \n";
Here you can't easily see that the array @values might not contain what you want (but many empty elements addtionally). This leads to many unitialized values in the further run of your program. You could use something like print join("XXX\n", @values);

If you look at your debug-output to more detail, you would see that the first (non-empty) element of @values is

0|0|{A=145,B=2,C=12,D=18}|!
and
Conf is 0 Rest is 0
... so your split is not working as expected ...

When debugging code, you should start from the beginning. Solve the points shown above. And only when you found a solution for those, continue by looking at the rest of the program. It will be much easier that way.

HTH, Rata

In reply to Re^4: Parsing and Obtaining Values from output by Ratazong
in thread Parsing and Obtaining Values from output by Perllace

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.