in reply to <STDIN> always in string mode?

If this is the specific case you're handling, please don't use eval, use oct() instead:
$val=<STDIN>; $val = oct($val) if $val =~ /^0/;
Or something like that...