Title: RE: mystery
Peter Eisengrein wrote, on Wed 6/29/2005 13:04

: > Can someone tell me what's going on in my script? Here it is:
: >
: > use strict;
: > use POSIX qw(INT_MAX);
: >
: > my $i = INT_MAX;
: > my $n = INT_MAX - 1000;
: > print("i = $i\n");
: > print("n = $n\n");
: >
:
: Not sure of the *why* (I'm sure someone on the list smarter than I can
: answer), but it works if you change it to:
:
: my $n = INT_MAX() - 1000;

Simply because Perl handles constants like built-in functions. When you say "INT_MAX - 1000", that's equivalent to "INT_MAX(-1000)". Since INT_MAX is a constant function, you just get the max again.
 
Joe
 

==============================================================
          Joseph P. Discenza, Sr. Programmer/Analyst
               mailto:[EMAIL PROTECTED]
 
          Carleton Inc.   http://www.carletoninc.com
          574.243.6040 ext. 300    fax: 574.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years
 
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to