[comp.lang.perl] I would prefer ~= instead of =~

juha@ttds.UUCP (Juha Sarlin) (03/15/90)

I think it would be nice if the =~ operator was renamed to ~=.  This
would make it more consistent with the other assignment operators and
less ambiguous; eg, "$a =~0" is currently not the same as "$a = ~0".

Unfortunately this change would probably break most current perl scripts,
but perhaps ~= could just be added as an alias for =~ and !~= as an alias
for !~.  Then we'd only have to wait a few hundred years for everybody to
stop using the obsoleted operators. :-)
--
Juha Sarlin   juha@tds.kth.se

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (03/16/90)

In article <1275@ttds.UUCP> juha@tds.kth.se (Juha Sarlin) writes:
: I think it would be nice if the =~ operator was renamed to ~=.  This
: would make it more consistent with the other assignment operators and
: less ambiguous; eg, "$a =~0" is currently not the same as "$a = ~0".

But =~ isn't an assignment operator, exactly, even though sometimes it
requires an lvalue.

: Unfortunately this change would probably break most current perl scripts,
: but perhaps ~= could just be added as an alias for =~ and !~= as an alias
: for !~.  Then we'd only have to wait a few hundred years for everybody to
: stop using the obsoleted operators. :-)

I picked =~ and !~ because that's what csh uses.  (I would've used ~ like
awk but ~ means something else entirely in C.)  I think that the situation
$a =~0 arises much less frequently than the normal use of =~, and for the
former C shell programmers in the crowd, it would only cause more confusion
to switch.  Besides, $a = ~0 is much more readable, so I haven't much
sympathy.  I won't say what I think of 3 character operators--you wouldn't
like me any more...

Larry