# Pull out two dates from line 12 with a global match of # 2 digits, a space, three letters, a space 4 digits. The # round brackets allow you to capture what matches inside # them. # my ($startPeriod, $endPeriod) = $items[10] =~ m{(\d\d\s[A-Za-z]{3}\s\d{4})}g; # Transform date by capturing (round brackets) the day, # month and last 2 digits of the year in $1, $2 and $3 # then concatenating them; the 'e' flag after the # regular expression tells the regex engine to execute # the code to compute the substituting string. The '.' # is the string concatenation operator. # ($fld11 = $startPeriod) =~ s{(\d\d)\s([A-Za-z]{3})\s\d\d(\d\d)}{$1 . $2 . $3}e; ($fld12 = $endPeriod) =~ s{(\d\d)\s([A-Za-z]{3})\s\d\d(\d\d)}{$1 . $2 . $3}e;