There are two main approaches to this problem insofar as
I can see. The first is to strip out the bits of text that
you don't want leaving the bits that you do want. The second
approach is to ignore the bits you don't want and use a regex
to match the bits that you do want (the records). I would be
inclined to strip out the header using something along the
lines of:
#!/usr/bin/perl -w
use strict;
my ($REPFILE, $report);
undef $/; # Allows whole file to be slurped
open REPFILE, "sample.rep" or die "Can't open file $REPFILE: $!\n";
$report = <REPFILE>; # All file now in report variable
# Only do this for reasonably sized
# report files or buy some memory :)
$report =~ s/^User Report//g;
$report =~ s/^Other Header Stuff//g;
print $report;
Second approach, building a regex to strip out the data you
do want is left as an exercise for the reader.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|