in reply to how to search a pattern occured more than once in line
for (@Read){ while (m/Number-(\d{4}-\d{4})/g){ print "$1\n"; print WR1 "$1\n"; } }
By putting the parenthesis only around these parts of the regex that you want to capture, you avoid the substr alltogether.
\d{4} is short for \d\d\d\d
|
|---|