On Jun 23, 2004, at 12:59 PM, [EMAIL PROTECTED] wrote:


OK. I am reading a file. This line is at the bottom of the
file and the "****-----------******" is a sign that the section is complete.

This may be a sign that you aren't reading the file in the easiest possible way. I wonder if setting the input separator to this sequence would be the way to go. Something like:


local $/ = '****-----------******';

I need to be able to pick up that line, and see if there is
also code on the beginning of that line that I need to save.

save( $1 ) if m/^(.+)\Q****-----------******\E$/;

So in this case I was searching for words (with colon's)
and perhaps other code that precedes the "****----****"
and to try and discard the end of the line. (After the word
FILING, there is a page break character, but it's all being
read in as one line.)

Is that a form feed character? Is it the only one in the file? You might be able to use that somehow. Ideas:


local $/ = "\f";

# or ...

save( $1 ) if m/^([^\f]+)\f/;

# or ...

my $words = (split m/\f/, $your_line)[0];

This is a sample of the line:
Comment: FILING ****------------------------------------------------------------------- -----****


That's why I tried (and failed :>) with this:
if (/(\w+:?\s*\w*:?)+(.*?\*+\s*-+\s*\*+\s*)$/)  {
    s/$2//;
}

I hope that helps.

Hopefully the above might give you some fresh ideas.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to