The following code works to a point. It is writing name and email address out to a file. The only real problem is the msg "Complex regular subexpression recursion limit (32766) exceeded at /usr/share/perl5/Email/Address.pm line 108."
#!/usr/bin/env perl # use strict; use warnings; use File::Find; use File::Slurp qw( read_file ); use Email::Address; my $directory = '/home/*****/Mail/.family.directory/Browne, Bill & Ma+ +rtha';'; my $outfile = 'output.txt'; my @found_files; find( sub { push @found_files, $File::Find::name }, $directory ); foreach(@found_files){ my $file = "$_"; if (-f $file) { print $_,"\n"; my $intext = File::Slurp::read_file( $file ); my @emails = Email::Address->parse( $intext ); File::Slurp::write_file( $outfile, {append => 1 }, join("\n", @ema +ils) ); } }
The file that the warning msg appears has a large attachment. So, somehow need to bypass any attachments in the slurp ?
In reply to Re^3: extracting name & email address
by peterr
in thread extracting name & email address
by peterr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |