• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 131
  • Last Modified:

What is the output of 32>>4 in perl

What is the output of 32>>4; in perl and how to do? Can you please tell me?
0
GouthamAnand
Asked:
GouthamAnand
  • 2
1 Solution
 
ozoCommented:
there is no output, since there is no output operation, just a value,
the value is 2

see
perldoc perlop
0
 
ozoCommented:
perldoc perlop
   Shift Operators
       Binary "<<" returns the value of its left argument shifted left by the
       number of bits specified by the right argument.  Arguments should be
       integers.  (See also "Integer Arithmetic".)

       Binary ">>" returns the value of its left argument shifted right by the
       number of bits specified by the right argument.  Arguments should be
       integers.  (See also "Integer Arithmetic".)

       Note that both "<<" and ">>" in Perl are implemented directly using
       "<<" and ">>" in C.  If "use integer" (see "Integer Arithmetic") is in
       force then signed C integers are used, else unsigned C integers are
       used.  Either way, the implementation isn't going to generate results
       larger than the size of the integer type Perl was built with (32 bits
       or 64 bits).

       The result of overflowing the range of the integers is undefined
       because it is undefined also in C.  In other words, using 32-bit
       integers, "1 << 32" is undefined.  Shifting by a negative number of
       bits is also undefined.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now