Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Also, in this sub, the code to not copy all the email header noise lines is also somewhat inelegant. Any sugestions? Criticisms? Regards, -allansub display_email { my ($fn) = @_; print "<center>file <i>$fn</i></center>\n"; if ( open( EMAIL, $fn ) ) { print "<hr width=600><br>\n<pre>"; while( $_ = <EMAIL> ) { if ( /^Message-Id:/ || /^Content-Type:/ || /^Content-Disposition:/ || /^Content-Transfer/ || /^X-[-\w]*:/ || /^Status: RO/ || /^Mime-Version:/ ) { next; } if ( /^\s/ && $rcvdflag ) { next; } if ( /^Received:/ ) { $rcvdflag = 1; next; } if ( /^[^ ]/ ) { $rcvdflag = 0; } if ( length($_) > 80 ) { chop; do { print substr( $_, 0, 80 ) . "\n"; if (length($_) > 80) { $_ = substr( $_, 80, length($_) - 80 ); } else { $_ = ""; } } while length($_); } else { print $_; } } print "</pre>\n"; close( EMAIL ); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how do I line-wrap while copying a file to stdout?
by nardo (Friar) on Apr 20, 2001 at 11:14 UTC | |
by chipmunk (Parson) on Apr 20, 2001 at 21:06 UTC | |
by ams (Initiate) on Apr 20, 2001 at 11:24 UTC | |
by bpaulsen (Initiate) on Apr 20, 2001 at 19:28 UTC | |
by bpaulsen (Initiate) on Apr 20, 2001 at 19:32 UTC | |
|
(tye)Re: how do I line-wrap while copying a file to stdout?
by tye (Sage) on Apr 20, 2001 at 19:53 UTC | |
|
Re: how do I line-wrap while copying a file to stdout?
by busunsl (Vicar) on Apr 20, 2001 at 11:22 UTC | |
by ams (Initiate) on Apr 20, 2001 at 11:35 UTC |