in reply to Inappropriate ioctl for device

$! will only contain a meaningful value after *failure* of a system related operation. If the operation was successful, $! may, or may not be set - and if set, it could be anything. Use the return value of open to determine whether the action succeeded, not the value of $!.

Abigail