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

Re: [MacPerl] FNG



perlguts.pod has some interesting stuff about scalar variables, and it
clarifies (somewhat) the value of sv_no, which is a boolean false. 

Scalars seem to be like Schršdinger's cat. They are both integers and
strings until observed/used, in which case they behave as one or another
as needed. (Actually, scalars can be *four* different types, as
explained in perlguts.pod.) Then they are put back in the box until used
again.

As Ronald said below, the bitwise operators are funny because it matters
what type something is when you do bitwise operations. An int, a char
and a double may be different numbers of bits, depending on where perl
was compiled. You can't simply do a bitwise operation on perl's mighty
morphin' scalar.

Geoff


Ronald J. Kimball wrote:
> 
> Chris Nandor wrote:
> >
> > At least, this makes the Camel wrong as I read it.  But it seems clear to
> > me that these scalars are typed as strings and as numbers depending on how
> > you used it.  Else ~$x would always produce the same thing, since in every
> > case $x == 1 (and $x eq '1' :).
> >
> 
> The Camel also states that the bitwise operators are one of the few places
> where Perl actually does care whether a scalar is a number or a string.
> (And I suppose the only reason for that is because there aren't two sets of
> bitwise operators, as there are two sets of comparison operators.)
>

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