in reply to The first two number
Use ^ to start from beginning of the line.
$no = '77373737377837'; $newno = $1 if $no=~m#^([0-9]{2})#; print "\n$newno"; [download]