Another solution, which may applied for all those messages that appear NOT to follow the typical /^--/ signature indicator is to read lines from the back of the message up, until you get to a white space line. Then if the last read line (eg the line after the white space) starts with any repeated symbols, such as - or *, it's a good bet that it's a signature. This will err on the side of keeping anything that doesn't look like a sig, even though it might be.
my @message = (<MESSAGE>); my @possible_sig; my $line = pop @message; # Read past white space that may trail message while ( $line =~ /^\s*$/ ) { $line = pop @message; } # Read in what may be the sig... while ( $line !~ /^\s*$/ ) { unshift @possible_sig, $line; $line = pop @message; } # at this point, @message contains the original message, # minus the last 'paragraph' minus trailing whitespace. # @possible_sig contains this last paragraph. # If the first element of @possible_sig does look # like a standard sig, then we just drop it, and @message # is ready to go. Otherwise, just reattach it. if ( $possible_sig[ 0 ] !~ /^[-\*%]{2,}/ ) { push @message, $line; # (put that whitespace back!) push @message, @possible_sig; } # @message can now be written to file.
update: er, code was right, comment was wrong. @possible_sig should be dumped if it looks like a sig.
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

In reply to Re: Removing Signature from Email by Masem
in thread Removing Signature from Email by HTTP-404

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.