I've written a script/program but when want it to get the <img src="abc.jpg"> form my input. Essentially I have something like this:
EDIT: This is the chunk of code I'm trying to get extracting images, but this is broken. I can't figure it out!
Code:
foreach my $link ($mech->links)
{
if ($link->url =~ /html/)
{
if ($filter)
{
if ($link->text =~ /$keywords/i)
{
print FILE '<a href=' . "$preurl" . $link->url, '>', $link->text, '</a><br \>';
}
}
else
{
print FILE '<a href=' . "$preurl" . $link->url, '>', $link->text, '</a><br \>';
my $imglink = $preurl . $link->url . "\n";
print "$imglink";
########################
my $imageref = $mech->find_image( url_regex => qr/'$imglink'/ );
my $ref_type = undef;
my $img_link = undef;
if ($mech->success){
$img_link=$imageref->url();
$ref_type=ref $imageref;
}
else
{
print "No image found\n";
}
how can I properly extract the image name/tags from this?
I'm using perl