This is option 1 ok This is option 1 version b Option 1 version 3 Option 1 version 4 Perl #### my $filename="test.txt"; my $template_data = "/content".$filename; open(DATA_IN, "$template_data") || print "Can't open output file1: $template_data\n"; #my @file = ; # read it into @file #foreach my $line (@file){ #chomp($line); #print @file; while(){ # if($line =~/^(<\?--\.*\-\.*\-->)\s(.*)\s(<\/\?--\.*\-\.*\-->)\s/ig){ # if($_=~/^<\?--(.*)-(.*)-->(.*)<\/\?--(.*)-(.*)-->/){ # if($_=~/(<\?--(.*)-(.*)-->)(.*)(<(.*)>)/g){ # if($_=~/^<\?--(.*)-(.*)-->(.*)<\/\?--(.*)-(.*)-->/g){ # if($_=~/^<(.*)>(.*)<(.*)>/g){ print "$1"; print $2; print "$3"; }else{ print "$Nothing"; } }