in reply to Re: Why Perl
in thread Why Perl

In Perl + is always addition, and concatenation has a different operator
Except 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 type
Except 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).

Replies are listed 'Best First'.
Re^3: Why Perl
by moritz (Cardinal) on Feb 01, 2010 at 13:35 UTC
    Except 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.

    That's true. Since Perl is a quite mutable language, you can always shoot yourself and other in the foot with modules.

    the symbol determines the operation, not the type
    Except when it doesn't.

    Sure, there are unfortunate exceptions. As far as I can tell they have been removed in Perl 6.

    Perl 6 - links to (nearly) everything that is Perl 6.