I assume you are not posting all the code (maybe this is a good thing), but one important thing that is missing here is "use strict" -- you do have a lot of "my" declarations, so if you aren't using stricture, it shouldn't be hard to add.

Anyway, given what you have posted, I would be surprised if the execution went beyond this block:

if ($totalFound eq scalar(@userArray)) { exit (0); }
Near as I can tell, you don't have any code that adds an element to @userArray -- so scalar() on that would always be zero. Then, the part that increments $totalFound is inside a loop over the elements of @userArray -- and since that is always zero, $totalFound never gets incremented, so when the above if statement is ever reached, that is where the script will exit, every time.

As for how to track what's going on, the perl debugger is pretty easy to learn; read the perldebug man page, and run the script with "perl -d". But before you do that, make sure you have "use strict;", and try "-w" (or "use warnings;") as well. Maybe try a little refactoring while you're at it...


In reply to Re: Why my perl script skip my some of the executed lines even without using conditions?? by graff
in thread Why my perl script skip my some of the executed lines even without using conditions?? by fabster01

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.