in reply to Counter Intuitive Code

writch:

As has been mentioned, you're getting the "string" bitwise conversion. Since you want to use numeric, just change the line:

my $or;

to:

my $or = 0;

This way, since you'll have a numeric value in $or, perl will convert the operands to integers before doing the '|', and you'll get the desired numeric version.

...roboticus

When your only tool is a hammer, all problems look like your thumb.