Most of the time, it is enough to just output the error message in $! to the user, so they can figure out what's happening. If you want to find out more about the exact condition, I'd suggest you use the -X operators, e.g.
die "Can't read $_" unless -r; die "Can't write $_" unless -r; die "Can't execute $_" unless -x; die "$_ not a file" unless -f; die "$_ not a directory" unless -d; # ...
In reply to Re: How portable are common $! error codes?
by crenz
in thread How portable are common $! error codes?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |