Perl is worse!

Jake Speed speed at ?.com
Fri Jul 28 16:17:17 EDT 2000


max at alcyone.com (Erik Max Francis) wrote in 
<3981DB97.E367C81E at alcyone.com>:

>If 1 + 1 == 2 and '1' + '1' == '11' (note, not 11), then what should 1 +
>'1' or '1' + 1 do?  Implicit type conversion between incompatible types
>(integer and string) is a bad idea in a strongly-typed language.

A short, perlish aside:

#!/usr/local/bin/perl
printf "%s\n", 3 & 10;
printf "%s\n", 3 & "10";
printf "%s\n", "3" & 10;
printf "%s\n", "3" & "10";

($x, $y) = "3 10" =~ /(\d+) (\d+)/; 
printf "%s & %s = %s\n", $x, $y, $x & $y;

====
2
2
2
1
3 & 10 = 1

I like Perl, really I do :^)

-Speed!




More information about the Python-list mailing list