in reply to Reading and Separating Data From a File Using Regex

Perhaps you have a good reason for eschewing use of a module, but comments like "I am trying to do it in regex and not use a specific module." are often ill-founded unless rooted in exercising/expanding your knowledge.

Nonetheless, split and a regex will do the job (for your limited sample data):

use warnings; use strict; # 737495 my $text = ' example.txt "unimportant1" "unimportant2" "unimportant3" +"time" "data1" "data2" '; my @words = split/ /,$text; for my $word(@words) { if ( $word =~ /(data)(\d)/ ) { print "Data" . $2 . ": $1$2 "; } } =head Execution: perl 737495.pl Data1: data1 Data2: data2 =cut