/home/test/abc/.date_run_dir /home/test/def/.date_run_dir /home/test/abc/.date_file_sent.email@wolverine.cole.edu /home/test/abc/.date_file_sent.dp3.drew.net /home/test/def/.date_file_sent.email@wolverine.cole.edu /home/test/def/.date_file_sent.dp3.drew.net #### use strict; #use warnings; my $file = '/home/test/FileList.txt'; open my $FILE, '<', $file or die "unable to open '$file' for reading: $!"; while (my $line = <$FILE>) { chomp($line); #if ($line =~ m#home/test/(\w{3}).*[.](\w+)[.].*#) { if ($line =~ m#home/test/(\w{3}).*[.](\w+)[.]?.*#) { #print "$line\n"; .last_file_sent* open my $file2, '<', $line or die "unable to open '$file' for reading: $!"; while(my $line2 = <$file2>) { print "Type:$1:School:$2:File:$line2"; #print "$line2"; } close $file2; } } #end while close $FILE; #### Type:abc:School:date_run_dir:File:/product/classroom/subject/data/sysfeed_abc_2010120810.ext3 Type:def:School:date_run_dir:File:/product/classroom/subject/data/sysfeed_def_2010120806.ext3 Type:abc:School:edu:File:domain_abc.dat.2010120810.ext3 Type:abc:School:net:File:domain_abc.dat.2010120810.ext3 Type:def:School:edu:File:domain_def.dat.2010120805.ext3 Type:def:School:net:File:domain_def.dat.2010120804.ext3