Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!perl.exe my $filename="out.txt"; if (-r $filename) { open(FILE,$filename); while(<FILE>) { chomp; if (/^(.*)Datasource:/) { print "\n\n", $_, "\n"; } if (/^(.*)Passed:/) { $section="passed"; next; } elsif (/^(.*)Failed:/) { $section="failed"; print $_, "\n"; next; +} elsif (/^(.*)Exception:/) { $section="except"; print $_, "\n"; nex +t; } if ($section ne "passed") { if (/(^(.*)test\.)|(^(.*)Summary:)/) { print $_, "\n"; } } } close(FILE); } else { print("cant read file ",$filename,"\n"); }
Edit Masem 2001-10-22 - CODE tags
Edit kudra 2001-10-23 - changed title per ntc request
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: simple regex question
by Fletch (Bishop) on Oct 22, 2001 at 20:50 UTC | |
|
Re: simple regex question
by suaveant (Parson) on Oct 22, 2001 at 21:52 UTC | |
|
Re: simple regex question
by mull (Monk) on Oct 22, 2001 at 21:11 UTC | |
by Anonymous Monk on Oct 23, 2001 at 13:48 UTC | |
by pike (Monk) on Oct 23, 2001 at 16:39 UTC | |
|
Re: simple regex question
by CubicSpline (Friar) on Oct 22, 2001 at 21:20 UTC |