On Thu, 2004-06-24 at 14:17, Smylers wrote:
> Because the above would've been insane: saying that C<sif ($x)> treats
> $x as a string would be pretending that C<if> always treats its
> arguments as numbers, but something such as C<if ($x eq 'frog')> doesn't
> have any numbers in it.
Doesn't it?
perl -e '$x = "frog"; print(($x eq "frog") . "\n");'
> No; none of the above strings are "interchangeable". All of those
> strings have the numeric value of zero when treated as a number, but
> then so does the string "crumpet". Being interchangeable involves
> swapping them either way round.
Erm, we're talking about boolean context, right? All those strings
evaluate to true. I'm asking about being interchangeable when used in a
conditional statement; of course they're not interchangeable with each
other. :)
> Larry's plan to drop this in Perl 6 for
> things explicitly typed as strings sounds sensible to me.
That's the plan? Happy day! I was not aware of that. Because I didn't
see anything about this in Perl 6 Essentials, I just figured that
Perl5's '0'==undef was being brought forward into Perl6. The horror!
Sorry for the bad assumption. :)
- Scott