in reply to How do I return false and set an error in special variable $!

My reading of perlvar is that you can't set $! to a particular string. You can set it to a particular number so that it will stringify to a particular error message, but that's it.

use strict; use warnings; $! = 'foo'; print "bang: $!\n"; $! = 3; print "bang: $!\n"; __END__ Argument "foo" isn't numeric in scalar assignment at perlmonks.pl line + 8. bang: bang: No such process

I'd suggest you use a package variable to pass your error messages or throw full blown exceptions (see Exception::Class) with as much detail as you like.