in reply to regexp operator -- same mistake over and over again

Makes sense to me. Every other operator with the 'equals' in it has the 'equals' last, e.g. += or *= (Otherwise $foo =+ 20 would be parsed as $foo = +20)

The =~ is the opposite and that makes it confusing.

  • Comment on Re: regexp operator -- same mistake over and over again

Replies are listed 'Best First'.
Re: Re: regexp operator -- same mistake over and over again
by Anonymous Monk on Jan 23, 2004 at 12:23 UTC
    by analogy with +=
    $foo ~= s/a/b/;
    should be equivalent to
    $foo = $foo ~ s/a/b/;
    so maybe ~ should be a binary operator that returns the result of the substitution whereas ~= would apply the substitution to $foo