in reply to why divide 256 for the exit code

This is an example of the baggage Perl carries from its birth on UNIX. It is a reflection the "real" exit code on UNIX, and it even does that on Windows. If you really want to know the rational, then look at the POSIX standard for exit(). In particular "only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent process."

Of course when this was designed everyone knew what an exit code looked like, so Perl just did what everyone expected. Nowadays few people know or care how the OS really operates. Sob.