I have a local file (a mailbox file actually) that I wish to parse and extract all of the various email addresses from. At this point, I do not care about their validity.
I've located the module Email::Find and installed it. In the POD there is an example given that appears to do what I'm looking for. Problem is the example is object oriented and I've not had any experience with OO thus far. I'm sure this is incredibly simple to those who studied and know OO, but I have not. I've spent a good amount of time searching for code using this module, but haven't found any.
The following is the basic example from the POD (I added my mailbox file):
#!/usr/bin/perl -w
use Email::Find;
$mailbox='./mail/addresses';
my $finder = Email::Find->new(sub {
my($email, $orig_email) = @_;
print "Found "..$email->format."\n";
return $orig_email;
});
$finder->find(\$text);
I need a little bit of a kickstart to get to understanding how to use the module.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.