in reply to regexp matching issue

I think you're trying to do something like this:

## read the file by block, not by line: open INPUT, '<', $filename or die($!); local $/ = "}\n"; # causes the end of block to be the "eol" my ($t1, $t2) = ('!test1','!test2'); # Now, determine from command line which tests to run my $commandline = join(' ',@ARGV); $t1 = $1 if $commandline =~ m/\b(test1)\b/; $t2 = $1 if $commandline =~ m/\b(test2)\b/; # Now cycle through blocks until we find the one we want my $correct_block; while (<INPUT>) { #remember, this reads whole blocks next unless m/template[.]*?($t1&$t2)/; $correct_block = $_; last; } ## $correct_block will now contain the block you want
this is both rough and untested. It's meant to get you on the right track, only

I hope that helps out a bit...


The Eightfold Path: 'use warnings;', 'use strict;', 'use diagnostics;', perltidy, CGI or CGI::Simple, try the CPAN first, big modules and small scripts, test first.