in reply to Exit with a number

That 256 is correct - you need to print $result >>8 to get rid of the first eight bits of the number which are put there by the OS

/J\