If you force the object to be numified by changing the argument of int to: $soldier1 + 0 (you will have to overload '+' or add fallback => 1 to the overload hash) you will see truncate being called.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re^3: overloading '0+'
by CountZero
in thread overloading '0+'
by syphilis
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |