@array = ('1ST','10ST','101ST'); foreach (@array) { ($start,$end) = m/(.*)(.{2})/o; print "start = $start\nend = $end\n\n"; }