I'm not sure what seems weird to you, the Perl error message or the printing of the number 255. If the former, it's not a bug: $? refers to the error message of a child process which you did not spawn before printing it. So although you explicitly set the variable, I am not terribly surprised that Perl complained and you didn't get the value of $? printed out.
As for the 255, I *think* that I vaguely remember (how's that for a disclaimer) mention on this site of Perl (or was it Carp specifically?) defaulting to octal 255 in some situations, but uselessly enough, I can't recall anything of the context of that thread, others I'm sure can enlighten both of us.