$x="1234567890asdfg"; while (length ($x) > 10) {chop($x)}; print $x;