#$string8 = (m/def(\d{8})/)[0]; #alternate way with list slice