At 15.50 -0500 1999.01.28, Vicki Brown wrote: >At 21:20 -0500 1/27/99, Chris Nandor wrote: >> At 19.51 -0500 1999.01.27, Vicki Brown wrote: >>>As sayeth the Camel, container of all knowledge (p. 38) >>> >>> While we might speak of a scalar as "containing" a number or a string, >>> scalars are essentially typeless; there's no way to declare a scalar of >>> type "number" or "string". Perl converts between the various subtypes as >>> needed, so you can treat a number as a string or a string as a number, >>> and Perl will do the Right Thing. >> >> We know, of course, this is not true, since these are different: >> >> ~'1' >> ~1 > > >How does the fact that these are different (one has been forced to be >a string, the other hasn't) make the statement from the Camel untrue? It says there is no way to declare a scalar of type number or string. If that were the case, then these would not return different values. A better example: #!perl -wl $x = '1'; # declared as string print ~$x; # treated as string $x += 0; # declared as a number print ~$x; # treated as number $x .= ''; # declared as string again print ~$x; # treated as string again 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' :). -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])