perl: bitwise operations on strings