$/ = ""; # read paragraphs while (my $para = <>) { my $lastHeading; my @lines = split(/\n/, $para); if (@lines == 1) # heading? { $lastHeading = $lines[0]; next; } my $hitMe; if ($lastHeading eq 'MEANINGLESS TEXT') { $hitMe = $lines[4]; # fifth line } elsif ($lastHeading eq 'ALTERNATIVE TEXT') { $hitMe = $lines[5]; # sixth line } # now do something... }
In reply to Re: Can PERL know a line without matching?
by bikeNomad
in thread Can PERL know a line without matching?
by brassmon_k
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |