K
kj
Check this out:
% perl -wle 'print 01'
1
% perl -wle 'print 1.'
1
% perl -wle 'print 01.'
syntax error at -e line 1, at EOF
-e had compilation errors.
% perl -wle 'print 01.0'
10
% perl -wle 'print +( 01.0 == 10 ? "weird!" : "whew!" )'
weird!
What's up with that? 01.0 is equal to 10???
I am also hoping that the explanation for this will also explain
why "01." triggers a syntax error, but not "01.0". If not, I'm
curious about that too.
If it weren't for the fact that "01.0" produces no errors, I would
have surmised that the syntax error triggered by "01." had something
to do with it being interpreted as an attempt to specify an "octal
float", but the fact that perl takes "01.0" without any objetion
(albeit doing something pretty strange with it) makes me question
this hypothesis.
Thanks!
kj
% perl -wle 'print 01'
1
% perl -wle 'print 1.'
1
% perl -wle 'print 01.'
syntax error at -e line 1, at EOF
-e had compilation errors.
% perl -wle 'print 01.0'
10
% perl -wle 'print +( 01.0 == 10 ? "weird!" : "whew!" )'
weird!
What's up with that? 01.0 is equal to 10???
I am also hoping that the explanation for this will also explain
why "01." triggers a syntax error, but not "01.0". If not, I'm
curious about that too.
If it weren't for the fact that "01.0" produces no errors, I would
have surmised that the syntax error triggered by "01." had something
to do with it being interpreted as an attempt to specify an "octal
float", but the fact that perl takes "01.0" without any objetion
(albeit doing something pretty strange with it) makes me question
this hypothesis.
Thanks!
kj