in reply to Removing Signature from Email
This response assumes the portion you want to remove is always on the line immediately after the signature designator.
## Assumes that name of file is in $messagename. Could ## easily be put in a sub and used that way. open (MESSAGE, $messagename) or die "Couldn't open email:$!\n"; while (<MESSAGE>){ # Test for the signature line if (/^--$/) { #get rid of the next line by reading it in. <MESSAGE>; } else { print $_; } } close MESSAGE or die "Couldn't close message:$!\n";
This may not be the most efficient code in the world, but it will get the job done -- it would be used by taking an input file and piping to an output file.
It's possible that someone can come up with a better solution by modifying $/ and then using a substitution to find that particular block that you wish to rid yourself of, but I'm simply not clever enough to do that tonight
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Removing Signature from Email
by HTTP-404 (Sexton) on Apr 08, 2001 at 13:40 UTC | |
by Wodin (Acolyte) on Apr 08, 2001 at 14:10 UTC |