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

Hi all,
Is there any limit to assign values in a scalar variable in Perl (say only n bytes can be assigned to a scalar like that)?
Thanks

Replies are listed 'Best First'.
Re: Scalar variable
by Fletch (Bishop) on Apr 26, 2007 at 17:40 UTC

    How much RAM do you have? How big are your system's pointers?

    (No, there are no artificial limits save those imposed by the underlying OS and C compiler.)

Re: Scalar variable
by swampyankee (Parson) on Apr 26, 2007 at 18:13 UTC

    The lengths of strings are limited only by the addressing limitations of the compiler used to build Perl, and the amount of available memory. Numerical values, unless using bignum are typically 8 bytes, at least on 32 bit machines.

    Of course, the array or hash reference to which a scalar variable points is limited only by available memory and addressing limits.

    emc

    Insisting on perfect safety is for people who don't have the balls to live in the real world.

    —Mary Shafer, NASA Dryden Flight Research Center