Book Home Programming PerlSearch this book

3.9. Shift Operators

The bit-shift operators (<< and >>) return the value of the left argument shifted to the left (<<) or to the right (>>) by the number of bits specified by the right argument. The arguments should be integers. For example:

1 << 4;     # returns 16
32 >> 4;    # returns 2
Be careful, though. Results on large (or negative) numbers may vary depending on the number of bits your machine uses to represent integers.



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.