On Jan 26, 2013, at 3:52 PM, Jim Gibson wrote: > However, if your program is successfully finding all of the <a> tag sections > of the web page, and your only problem is distinguishing between email links > and other types of links, you can use regular expressions to detect mailto > links: > > my $link = $email->attr('href'); > if( $link =~ /mailto:([\w@]+) ) { > print "Email address is '$1'\n"; > }
Better add periods to that regular expression character class: if( $link =~ /mailto:([\w@.]+)/ ) { … or include everything up to but not including the second double-quote: if( $link =~ /"mailto:([^"]+)/ ) { -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/