in reply to Can someone tell me why this hangs??

To debug your problem, just start adding print statements throughout your code. Then you can verify if each variable contains what you expect it to contain. If you end up in an infinite while loop, and get too much info scrolling quickly by your screen, just exit out of it.

You should have also posted a very short sample (10 lines) of your input file.

  • Comment on Re: Can someone tell me why this hangs??

Replies are listed 'Best First'.
Re^2: Can someone tell me why this hangs??
by Anonymous Monk on Aug 28, 2010 at 23:39 UTC
    I like to declare a variable at the top of the script, like $DEBUG or something catchy, then use if statements to print variables throughout the script. This way you can easily turn debugging off or on.

    Example:

    my $DEBUG = 1; #Set to 1 (print debugging info) or 0 (no debugging) print "Script executing...\n" if $DEBUG; do_stuff(); sub do_stuff{ print "sub->do_stuff()\n" if $DEBUG; #do things here... }