[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [long] Re: [MacPerl] Recommendations on how to port a MacPerl (fwd)



At 10.52 10/27/97, Mark Manning/Muniz Eng. wrote:
>One correction here.  The above should be:
>
>        if( $OSNAME == "MacOS" )
>
>The one given by Satrapa would make $OSNAME equal "MacOS".
>Also, according to the Perl book, even this is not
>correct.  It should be:
>
>        if( $OSNAME eq "MacOS" )
>
>since it is a string variable and not a number.  However, I
>do believe that Perl will correct the above on it's own.
>It's just that it takes a bit more overhead (ie: time) for
>Perl to figure it out.

No, it will not work.  In a numeric context, $OSNAME, $^O and "MacOS" are equal to 0.  eq will work, == will not.

In comparisons, Perl does care about whether something is a string or number, because they are evaluated differently.  For instance, 099 lt 1, but 099 > 1.

--
Chris Nandor               pudge@pobox.com           http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==                    MacPerl: Power and Ease                     ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch