Actually, there's a fairly explicit explanation in perldoc perlnumber:
The binary operators "+" "-" "*" "/" "%" "==" "!=" ">" "<" ">=" "<
and the unary operators "-" "abs" and "--" will attempt to convert
arguments to integers. If both conversions are possible without lo
of precision, and the operation can be performed without loss of
precision then the integer result is used. Otherwise arguments are
converted to floating point format and the floating point result i
used. The caching of conversions (as described above) means that t
integer conversion does not throw away fractional parts on floatin
++ "++" behaves as the other operators above, except that if it is a
string matching the format "/^[a-zA-Z]*[0-9]*\z/" the string
increment described in perlop is used.
Arithmetic operators during "use integer"
In scopes where "use integer;" is in force, nearly all the operato
listed above will force their argument(s) into integer format, and
return an integer result. The exceptions, "abs", "++" and "--", do
not change their behavior with "use integer;"
Note the exception for "++" -- which several of us, esp. /me -- forgot to mention...and the additional exceptions while using use integer.
BTW, there's some related matter (much less clear, to me, anyway) in perlvar... and perhaps (probably?) in other docs? How say you, Monks?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||