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

Re: [MacPerl] FNG



[Summary:  You can put values into $x that are explicitly numeric or
explicitly strings, while the Camel says you can't declare a scalar to
be a particular type]

One suspects that your example simply goes to prove the point the Camel
is actually trying to make:  the scalar "$x" cannot be pre-defined to
only hold a particular type of value.

pudge@pobox.com,Internet writes:
>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)
>>>>
>>>>   ... there's no way to declare a scalar of
>>>>   type "number" or "string". ...
>>>
>>> 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.