in reply to Return code from calling qx

Thanks everyone I found all of your refrences helpful. I'm having trouble understanding shift operators. When I run
qx(dir thisdoesntexist); print $?;
I get
File Not Found 256
Running
qx(dir thisdoesntexist); print $?>>8;
returns
File Not Found 1
What does it mean to be shifting bits by 8 and how did that change the return code to 1?

Thank you,

Jason

Replies are listed 'Best First'.
Re^2: Return code from calling qx
by johna (Monk) on Oct 27, 2009 at 20:06 UTC
    Think in terms of binary:
    100000000 (binary) = 256 (decimal)
    If you shift it 8 bits to the right (>> 8) you get:
    1 (binary) = 1 (decimal)
    Hope this helps a little.

    -John
      Yes that helps. Thanks John.
        ..with ends up with this demostrative scripts:
        print "the command -->@ARGV<-- returns:\n\n"; qx !@ARGV!; print "\n\n\$? $? (return status)\n", "\$?>>8 ",$?>>8, "(exit value of the subprocess)\n", "\$?&127 ",$?&127,"( which signal, if any, the process died from +)\n", "\$?&128 ",$?&128," (core dump)\n";


        Lor*