Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: I usually debug via...

by K_M_McMahon (Hermit)
on Feb 15, 2005 at 09:32 UTC ( #431077=note: print w/replies, xml ) Need Help??

in reply to I usually debug via...

I start with  -w and use strict so I generally catch errors as I go. I use a lot of print statements as I am creating a script to make sure everything is where I expect it to be, and if I am stuck chasing something specific, good old perl -d usually does the trick.

my $a='62696c6c77667269656e6440676d61696c2e636f6d'; while ($a=~m/(^.{2})/s) {print unpack('A',pack('H*',"$1"));$a=~s/^.{2}//s;}

Replies are listed 'Best First'.
Re^2: I usually debug via...
by dmorelli (Scribe) on Feb 24, 2005 at 14:52 UTC
    Kevin, your sig code was nagging me. I was able to shorten it down to this:

    perl -e '$a="62696c6c77667269656e6440676d61696c2e636f6d";print unpack("A",pack("H*","$1")) while ($a=~s/(^.{2})//s)'

    You don't need both the m// and s///, just one s/// will do. And the block { } notation after the while isn't necessary.

      hmm ... superdoc's version may be shorter or whatever, but it doesn't run on windoze due to a syntax error. Kevin's has the advantage of actually working.
        Hm. Could be that cmd.exe shell and quoting. Maybe this one will work:

        perl -e '$a=qq/447564652c2067657420726964206f662057696e646f 7773/;print (chr hex $1) while ($a=~s/(^.{2})//)'

        Or with double-quotes:

        perl -e "$a=qq/447564652c2067657420726964206f662057696e646f 7773/;print (chr hex $1) while ($a=~s/(^.{2})//)"
        I don't have access to any Windows machine at all to try it on.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://431077]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2018-06-23 05:30 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.