Alon Marx am Dienstag, 27. Dezember 2005 14.30:
> Seems like a good solution for my needs, but how do I use it in a perl
> program instead of an inline command?
>
> For example, if I try to set a variable with such a value:
> $a = (1<<$Config{ivsize}*8-1)-1;
>
> I get an error "Global symbol "%Config" requires explicit package name
> at"

You have to import the Config module with

        use Config;

Adriano imported it in the cmd line with

        -MConfig

hth, joe


[top posting history:]
> Thanks,
> Alon
>
> On Tue, 2005-12-27 at 10:51 -0200, Adriano Ferreira wrote:
> > On 12/27/05, Alon Marx <[EMAIL PROTECTED]> wrote:
> > > Is there a constant or a definition for a maximum number in perl? And
> > > the same question for a minimum value?
> >
> > This may work for you
> >
> > the biggest unsigned integer
> >
> > $ perl -e 'print ~0'
> > 18446744073709551615 # 64-bit integers
> >
> > the maximum signed integer
> >
> > $ perl -MConfig -e 'print( (1<<$Config{ivsize}*8-1)-1 )'
> > 9223372036854775807
> >
> > the minimum signed integer
> >
> > $ perl -MConfig -e 'print -(1<<$Config{ivsize}*8-1)'
> > -9223372036854775808
> >
> > I am not sure how general these expressions are. The illustrated
> > values are for 64bit integers.
> >
> > Adriano.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to