badger has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to handle bit-wise opperations on 64 bit values, and I am seeing unexplained behavior (ie, it's not working...) I theorized that my problem might be that I'm overflowing, so I thought I would check the range of PERL variables, but, the whole issue of variable types/ranges/sizes is overlooked in all of my reference books... Anyone out there know the range of a scalar in PERL?

20040407 Edit by BazB: Changed title from 'Scaler range'

Replies are listed 'Best First'.
Re: Scalar range
by Zaxo (Archbishop) on Apr 06, 2004 at 22:16 UTC

    It depends on how your perl is compiled. Perl usually uses 32-bit integers on common platforms, but 64-bit is available on most.

    See 'perldoc Config' from the command line, and look for the ivsize key.

    Update: Normally, bitwise operators force numeric values into the unsigned integer type, UV. They can be done on a string, as well, with vec to help. Be careful about bit and byte order, they can be tricky and unportable.

    After Compline,
    Zaxo

Re: Bitwise operations on a scalar
by borisz (Canon) on Apr 06, 2004 at 22:20 UTC
Re: Bitwise operations on a scalar
by Happy-the-monk (Canon) on Apr 06, 2004 at 22:21 UTC

    badger asks: Anyone out there know the range of a scalar in PERL?

    perldoc perldata says:

    A scalar is a single string (of any size, limited only by the available memory), number, or a reference to something (which will be discussed in perlref).

    I know, this is not about bitwise operation, but about what memory allows to store in a scalar. Cheers, Sören