/^(\d+)\W\d+\W\d+\W(\d+)\W\w+/; $CpmRC{$1}=$2; and this only catches the last two matches %CpmRC = /^(\d+)\W\d+\W\d+\W(\d+)\W\w+/;