Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Neat Debugger tricks

by VSarkiss (Monsignor)
on Nov 16, 2005 at 20:42 UTC ( #509183=note: print w/replies, xml ) Need Help??

in reply to Neat Debugger tricks

Not so much a trick in the debugger, but I like to use it as an "interactive Perl shell", using a command like perl -de 1. Of course, any expression other than -e 1 will work, I'm just used to that one.

For example, if you're wondering whether a particular regex will match, or whether your split will work as you intended, but you don't want to mess around with shell quotes, just:

$ perl -de 1 Loading DB routines from version 1.25 Editor support available. Enter h or `h h' for help, or `perldoc perldebug' for more help. main::(-e:1): 1 DB<1> $s = '12345' DB<2> x split(/(?<=\d)/, $s) 0 1 1 2 2 3 3 4 4 5 DB<3> q # yup, it works
I believe I first read about this in Effective Perl Programming.

Replies are listed 'Best First'.
Re^2: Neat Debugger tricks
by siracusa (Friar) on Nov 17, 2005 at 13:22 UTC
    I've always used "perl -de 0", but the too-clever version used to impress or confuse people is "perl -demo" :)

      I like perl -deal. Or, since we’re on PerlMonks, maybe perl -deacon?

      (Another classic, though it has nothing to do with the debugger, is perl -please as a fun if expensive replacement for cat.)

      Makeshifts last the longest.

        Then I suppose Grandmother would like perl -dearie ???

        And those bioperl folks would choose perl -deoxyribonucleic acid ?

        And the anti-DRM crowd would go for perl -decss ??

        Archeologists: perl -decrypt

        And when everyone is tired of this, I'll be asked to perl -desist ;)

        Quantum Mechanics: The dreams stuff is made of

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://509183]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2020-09-25 08:13 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (136 votes). Check out past polls.