[OT] Perl woes
Jonathan McKeown
jonathan+londonpm at hst.org.za
Wed Jan 28 12:22:51 GMT 2009
On Wednesday 28 January 2009 14:01:22 Paul Makepeace wrote:
>
> Interesting that everyone's said to "use warnings" but no-one's
> questioned what you're saying. Perl appears to me to DTRT:
>
> $ perl -le 'print "yes" if "a" == "2"'
> $ perl -le 'print "yes" if "a" == "a"'
> yes
> $ perl -le 'print "yes" if "1" == "1"'
> yes
> $ perl -le 'print "yes" if "1" == "0"'
> $ perl -le 'print "yes" if "1" == 1'
> yes
> $
>
> Can you give an example where perl is doing something surprising to you?
$ perl -le 'print "yes" if "a" == "b"'
yes
is mildly surprising. Luckily Perl can explain it:
$ perl -wle 'print "yes" if "a" == "b"'
Argument "b" isn't numeric in numeric eq (==) at -e line 1.
Argument "a" isn't numeric in numeric eq (==) at -e line 1.
yes
Jonathan
More information about the london.pm
mailing list