in reply to Removing Signature from Email
update: er, code was right, comment was wrong. @possible_sig should be dumped if it looks like a sig.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.
|
|---|