In Perl + is always addition, and concatenation has a different operatorExcept when it isn't. Blessed types can overload operators - and then it's the type of the operand(s) that determine what's going to happen.
the symbol determines the operation, not the typeExcept when it doesn't. | and & do behave differently depending on their operands - and it's more complicated than whether it's a number or a string; it'll depend on some internal flag. But more important is the context. Some operators behave wildly different in scalar and list context - but they have the same symbol(s).
In reply to Re^2: Why Perl
by JavaFan
in thread Why Perl
by madhugopala
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |