jump to navigation

Debugging: A Perl Pet Peeve December 24, 2009

Posted by ddouthitt in Debugging, Perl, Ruby.
add a comment

When Ruby hit 1.45 years ago, I tried it and fell in love with it right away. The biggest problem with Ruby is the same now as it was then: its not available on every platform; most commercial UNIXes don’t include Ruby.

Thus, I have kept up my Perl skills. However, I found that debugging is not the same – and thus a pet peeve of mine.

You can always introduce print statements – which is what one of the developers of C and UNIX maintains is the only way to go (instead of “debuggers”).

When debugging Ruby, one can do this:

p $a;

When debugging Perl, this is required instead:

use Data::Dumper;

print Dumper($a);

I’m also always confusing Dump() with Dumper() as well.

Why didn’t Perl use a simple method instead of a complicated library process? Who knows?

Even so, Perl has a sophisticated built-in debugger which Ruby does not – but as mentioned before, printing variable contents can be more profitable for debugging purposes.