I cannot distinguish between an integer and a string. Is there a way?
You shouldn't need to discover whether a scalar actually contains the number or its string representation. The logic of your program will define which type of bitwise operation you want, and you can easily force this to be used.
If you want to do integer bitwise operation:
my $res = 0+$x | 0+$y;
If you want stringy bitwise use:
my $res = ''.$x | ''.$y;
In reply to Re: "2" | "8" = ":" and 2|8=10
by BrowserUk
in thread "2" | "8" = ":" and 2|8=10
by MSoegtropIMC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |