Whoah, hold on. Where on earth did you get the idea that bitwise operations are numerical operations? They're not.
I meant numerical as in takes a number as an argument (123) as opposed to a string ("123"). I thought this was obvious from the context.
Doing a bitwise operation in strings (especially XOR or a left or right shift, but sometimes and and or an or) is quite a common operation, one that we would *not* want to have randomly break if one of the strings happens to contain digit characters by some coincidence.
Which is exactly my point :-) Random breakage is exactly what the current | operator's behaviour causes, just from the other side. Numerical bit based operations and string based bit operations are equally useful - but munging them together in one operator is asking for trouble in a language that transparently translates between numbers and strings in most contexts.
But you absolutely don't want to just make the bitwise operators that we have in Perl5 magically numerify their arguments.
I agree completely. I don't think I ever suggested it. However what we have now is just as bad since Perl programmers are used to strings containing numbers acting like numbers.
In reply to Re^4: Can you spot the problem?
by adrianh
in thread Can you spot the problem?
by dws
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |