in reply to Why my perl script skip my some of the executed lines even without using conditions??
Anyway, given what you have posted, I would be surprised if the execution went beyond this block:
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.if ($totalFound eq scalar(@userArray)) { exit (0); }
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...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why my perl script skip my some of the executed lines even without using conditions??
by fabster01 (Initiate) on Apr 12, 2006 at 09:22 UTC | |
|
Re^2: Why my perl script skip my some of the executed lines even without using conditions??
by fabster01 (Initiate) on Apr 12, 2006 at 10:02 UTC |