In perlvar, it is seen, $! is $OS_ERROR, that is, an error from the OS. I presume that your program is not the OS... you can't set $! AFAIK. I presume that you want to have error messages other than the standard ones from the OS, which you can't get from $! AFAIK. There is a way to set $@ to whatever you wish, though: by dieing. Other than that, I see no other way to signal errors, other than maybe making the return value an object which stringifies and numifies to itself, but which boolifies to false... perhaps using "Falsify" scalar strings?
Update: Thanks tilly. Apparently my tests hadn't covered every case. They had, however, covered the case in question.