It also normalizes undefined values to the false empty string, so that the calling code needn't guard against warnings. I'm not sure if context makes any difference here; I have this feeling it does, but a few very quick tests didn't confirm it.
I was assuming (on the basis of the name and the way it was being used) that $ok in the original example was a boolean value, hence could be returned directly without the need for further cleaning.
I did actually think of suggesting !!$ok originally, but I remembered the controvercy the idea engendered when I suggested that once before at Re: Re: variable set to 0 ? 0 : 1, so I tried to dodge the issue.
However, it seems there is always some jerk ready with the -- marker even when they obviously do not understand the issues at hand. Even asking a question (as at Re: Re^2: Double your return!!!! is enough to get the language lawyers scribbling. It's a real shame they don't have the bottle to expound their opinions with words as well as actions.
FWIW, I learned another tid-bit. Thankyou.
Examine what is said, not who speaks.
The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.