print int ($num / 100); or print substr($num,0,1); or if ($num=~m/(.)/) {print $1}