The enscript command does work from the command line and in the perl script. For some reason it seems that the == 0 or die section evaluates to the die. I do not know why considering that the other system calls work without dying. Also, I checked the $! variable after earlier system calls and the contents was already "Inappropriate ioctl for device" so it seems that this message may not be related.