G
Gary Yngve
[Note: parts of this message were removed to make it a legal post.]
The proper way to see if something doesn't match is
"foo" !~ /bar/
The ~/blah/ operator exists to apply to $_
Unfortunately this means that
"foo" !=~ /bar/
does
"foo".!= (~bar), which doesn't produce an error, even though it's basically
garbage.
Instead it fails silently by returning true (nil or an number are not
strings).
Is there a way w/ Ruby to define a mega !=~ operator and either have it do
!~ or have it throw an exception?
Or an easy way w/ Ruby to have the parser warn about it?
Alas google is not good for searching for !=~, so apologies if this has been
previously discussed.
Thanks,
Gary
The proper way to see if something doesn't match is
"foo" !~ /bar/
The ~/blah/ operator exists to apply to $_
Unfortunately this means that
"foo" !=~ /bar/
does
"foo".!= (~bar), which doesn't produce an error, even though it's basically
garbage.
Instead it fails silently by returning true (nil or an number are not
strings).
Is there a way w/ Ruby to define a mega !=~ operator and either have it do
!~ or have it throw an exception?
Or an easy way w/ Ruby to have the parser warn about it?
Alas google is not good for searching for !=~, so apologies if this has been
previously discussed.
Thanks,
Gary