Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
First off, not a bad bit of code. I notice that you're
checking the returns from your opens, which
is a very good thing.
I can't help but wonder why, in WriteTOCline, you take the two-step approach of sprintf followed by print instead of just using printf. And now, a few more Perlish ways to do a few things: You can shorten if ($_ =~ /^X-UIDL: \w{32}/) { to if (/^X-UIDL: \w{32}/) {. The $_ is implied on matches unless another variable is explicitly used. All instances of $Variable = $Variable + n can be shortened to $Variable += n with no loss of readability to anyone who knows Perl (or C, for that matter). Probably the biggest change you could make, and one which would be very educational for you, would be to read RFC 822, which defines the format of email messages, and use that knowledge to set $/ to something useful so that you could slurp up whole messages at a time instead of reading them one line at a time. Finally, I'll rain on your parade a bit by telling you that you're reinventing the wheel. If you want the semi-official Perl package for handling email, have a look at Graham Barr's MailTools bundle. In reply to RE: PineTOC
by splinky
|
|