print ~"3"; print pack("c",~ord("3")); # Or... print ~3 print unpack("L", ~"\x00\x00\x00\x03"); #### $x = "3"; print ~$x; # This is... $x = 3; print ~$x; # Not the same as this... $x .= ""; print ~$x; # But, after stringification, it is.