in reply to Email::Find question
The easiest way to get what you want (but perhaps not satisfactory in terms of OO/modular design) would be to use an array that is "global" to the main caller and callback function:
(Note that by returning undef, the callback will be removing email addresses from the original text string as they are processed.)#!/usr/bin/perl use strict; use warnings; use Email::Find; my $text = "this is some text test\@email.com foo bar"; my @found; my $finder = Email::Find->new( \&find_email ); $finder->find(\$text); print "Found says @found\n"; exit; sub find_email { my ( $email, $orig_email ) = @_; my $ret = $email->format(); print "sub says " ,$ret, "\n"; push @found, $ret; return; } # end-sub
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Email::Find question
by ikegami (Patriarch) on Mar 12, 2007 at 08:46 UTC |