> > eq and ne are far more confusing.
> 
> Hm. I've never had problems with this, although it does confuse me to go
> back to the shell's [ ] (aka test) and have them be backwards.

Yeah, I've got them finally sorted out, it only took me about 5 years...
;-P

> >    if ( $x == m/stuff/ ) { ... }
> >    $str = s/$old/$new/gi;
> 
> I don't understand your intent. What would s/// return? Or did you
> intend $str == s///?

Sorry, I always do that! Way too terse with my examples. Here's the
idea:

   ==, !=    -    comparison (like =~, !~ in m//)
   =         -    assignment (like =~ in s///)

So, the above examples would be:

   if ( $x == m/stuff/ )    # if $x matches m/stuff/ (=~)  
   if ( $x != m/stuff/ )    # like !~
   $x = ($r = m/stuff/);    # like $x = ($r =~ m/stuff/) ?
   $str = s/$old/$new/gi;   # = replaces =~

The boolean context wouldn't work with this notation in Perl 5, but with
better Perl 6 contexts I don't see why this couldn't be made to work.

And then =~ and !~ are gone and everyone's happy! :-) Actually, if we
could merge these into =, ==, and != that's fine by me, since m// and
s/// are already explicitly doing extra stuff anyways.

-Nate

Reply via email to