Welcome to the Monestary ploaiza.
Here's an approach to your problem, but since you haven't clearly stated what your problem was (with example code, for instance), it might be a complete miss). And moreover it is a quick and dirty hack
open (O, "rules.txt") or die "$!";
my ($wanted_lines);
{
local $/ = undef; # 'Slurp' mode on
my $whole_file = <O>;
close O;
$whole_file =~ /FirstWord(.+?)LastWord/s;
$wanted_lines = $1;
}
print $wanted_lines
Update
danger solution is really neat! forget mine!
Though, while looking at your code, one can see it is not really 'perlish'
Here are a few point that could improve your perl coding style.
($_ =~ /^Lot Code/) can be replaced by (/^Lot Code/) as the match is against the $_ anyway.
- your open is surely placed in the wrong spot as it will be called for each lines of your input file. Place it just after the '}'
for ($j=0; $j < $i; $j++) You can use the '..' operator to make things clea(n|r)er: for (0 .. $i)
- You could perhaps use a Hash of Hashes instead of a zillion of arrays, with the key being $i:
my %datas = (
1 => {subject => 'foo', failed => 'bar',},
2 => {subject => 'baz', failed => 'too',},
);
<kbd>--
PerlMonger::Paris(http => 'paris.pm.org');</kbd> |