I think you'll do better with a post that requires a lot less code. Asking strangers -- even kindly ones like (some of) the Monks -- to scrub 400 lines of code is a bit much.

OTOH, in the spirit of Charity (it seems to be paying its decennial visit) and despite the fact this isn't the root of your problem, use strict; use warnings would tell you that:

Use of comma-less variable list is deprecated at F:\_wo\_perl\pl_test\ +909098.pl line 43. ... Use of comma-less variable list is deprecated at F:\_wo\_perl\pl_test\ +909098.pl line 101.

I'm running 5.12, and too lazy to check the delta to see when the deprecation began, so maybe your perl won't produce that series, but you should check, anyway.

And, though again not the cause of your problem, $my_var1 and $my_var2 are not declared before use in the 390s (Note: my line numbers are offset from your by about 5 or 6).

And -- Charity not yet satisfied (well, neither am I) and still urging kindness -- the construct at your 391 - 394 is a tad suspect; an if with ONLY an else. Your script seems to arrive here with the conditional in a false value, suggesting you focus on your compare sub... but even Charity is exhausted now.

Give her a break; if attacking the issue with debug is too hard, insert some (more) print statements to test conditions at various points in your script... and then submit a boiled down version -- 10 to 20 lines -- which illustrates the failure, assuming that hasn't illuminated your understanding.


In reply to Re: Unexpected output for given program with write function by ww
in thread Unexpected output for given program with write function by dipesh777

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.