http://www.perlmonks.org?node_id=752859


in reply to Tracking down the line in error or warning

When I run that code, I get:

{C} > wtf.pl Use of uninitialized value in pattern match (m//) at C:\tmp\wtf.pl lin +e 10.

Line 10 is the pattern match in question. In any case, if it had spewed line 6, I would have looked at the IF block starting there and inserted some trusty "print "HERE\n" debug helpers to see where I was getting dumped out.

For more complicated logic trees and loops, I use PerlIDE - a simple freeware development tool that can do a step into/over debug which is really helpful if I'm stuck.

Replies are listed 'Best First'.
Re^2: Tracking down the line in error or warning
by RyuMaou (Deacon) on Mar 24, 2009 at 13:52 UTC
    Yeah, I was going to throw that in, too. Some well placed print statements can really make debugging easier.

    Also, and this may be obvious, but a text editor that shows the line numbers and highlights code can be a big help, too. Scanning through huge scripts looking for all the opening and closing brackets on functions is a lot easier when code is all pretty. It's embarrassing to me how many times my errors have just been one too many, or too few, brackets, parenthesis, or some similar typo.
Re^2: Tracking down the line in error or warning
by PoorLuzer (Beadle) on Mar 24, 2009 at 14:10 UTC
    Wow.. this version of PERL is nice.

    The original code that I "debugged" used PERL 5.8 for HPUX and the error message I posted was from ActivePerl 5.10.. both gave the same error message (5.8 did not show the $_ however)

    No other way than PerlIDE (which I believe runs only on Windows)?