in reply to <STDIN> always in string mode?
$val=<STDIN>; $val = oct($val) if $val =~ /^0/; [download]