in reply to Printing octal characters

Unless I've misunderstood, you want to use pack "C", $num to do this.