in reply to How do I find "@" in a string variable?

If you are fishing for email addresses within a string, then take a look at Email::Find and Email::Valid. As holli pointed out, a use strict; use warnings; statement would have caught that. However, this is a another method of fishing for emails.
use strict; use warnings; use Email::Find; my @emails; my $string = "dummy\@dumdum.com"; my $finder = Email::Find->new(sub { my ($email, $orig_email) = @_; my $escaped = $email->format; $escaped =~ s/@/\\\@/; push @emails, $escaped; return $orig_email; }); $finder->find(\$string); print @emails; __OUTPUT__ dummy\@dumdum.com

Replies are listed 'Best First'.
Re^2: How do I find "@" in a string variable?
by fmerges (Chaplain) on Dec 06, 2006 at 20:56 UTC