What is the output of 32>>4 in perl

Posted on 2009-04-29
Last Modified: 2012-05-06
What is the output of 32>>4; in perl and how to do? Can you please tell me?
Question by:GouthamAnand
    LVL 84

    Accepted Solution

    there is no output, since there is no output operation, just a value,
    the value is 2

    perldoc perlop
    LVL 84

    Expert Comment

    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.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
    In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now