I didn't think I needed the \s+ because in the perlre man page it says
$ matches the end of the line before the last newline.

Anyway, that did work so I wanted to thank you.

Sheridan

----- Original Message -----
From: "Tanton Gibbs" <[EMAIL PROTECTED]>
To: "Lysander" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, January 15, 2002 4:59 PM
Subject: Re: Matching Problem


> If it really is a blank line, then it will have a newline and won't match
> /^$/
>
> therefore, chomp the string before trying to match against it, or test for
> spaces
> /^\s+$/
> ----- Original Message -----
> From: "Lysander" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, January 15, 2002 6:07 PM
> Subject: Re: Matching Problem
>
>
> > ----- Original Message -----
> > From: "Jenda Krynicky" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, January 15, 2002 4:28 PM
> > Subject: Re: Matching Problem
> >
> >
> > > From:           "Lysander" <[EMAIL PROTECTED]>
> > > To:             <[EMAIL PROTECTED]>
> > > Subject:        Matching Problem
> > > Date sent:      Tue, 15 Jan 2002 16:07:41 -0600
> > >
> > > > I setup sendmail to forward mail for a specifc addy to my PERL
script.
> > > > I can't figure out how to match the blank line between the header
and
> > the
> > > > body of the message, though.
> > > >
> > > > I got ?^$? from an example in the perlop man page, but it doesn't
seem
> > to be
> > > > working.
> > > > Does anyone have a suggestion?  Below is the block of code in
> question:
> > > >
> > > > # Allow filename to be used instead of STDIN for debugging purposes
> > > > open (STDIN, $ARGV[0]) if (($ARGV[0] ne "") && ($ARGV[0] ne "-"));
> > > >
> > > > $msgbody = 0;
> > > >
> > > > @mail = <STDIN>;
> > > > for $mail (@mail)
> > > > {
> > > >   if ($msgbody == 1)
> > > >   {
> > > >     $count = @body;
> > > >     @body[$count] = $mail;
> > > >   } else {
> > > >     $msgbody = 1 if ($mail =~ ?^$?);  #Find Blank Line After Header
> > > >   }
> > > > }
> > >
> > > You should either use /^$/ instead or make sure you use the ?^$?
> > > correctly. Please reread the description in perlop manpage and if
> > > you are not sure you understand it use /^$/ instead.
> > >
> > > I've never used the ?? operator, so maybe you should not either :-)
> > >
> > > Jenda
> >
> > I tried:
> >
> > $msgbody = 1 if ($mail =~ /^$/);  #Find Blank Line After Header
> >
> > $msgbody = 1 if ($mail =~ m/^$/);  #Find Blank Line After Header
> >
> > $_ = $mail;
> > $msgbody = 1 if (?^$?);  #Find Blank Line After Header
> >
> > $_ = $mail;
> > $msgbody = 1 if (/^$/);  #Find Blank Line After Header
> >
> > and none of them worked.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to