#!/usr/bin/perl use strict; use warnings; use feature qw( say ); use List::Util qw( first ); use URI::Find; use LWP::Simple; # Container fuer URIs my @urls; # Sub Routines ###################################### { my %seen; sub callback { # $uri_url ist ein Objekt der Klasse URI::URL my ( $uri_url, $uri ) = @_; # URIs nur einmal hinzufügen push @urls, $uri if !$seen{$uri}++; } sub reset_seen { %seen = (); } } # Main Program ###################################### # http://www.amazon.com/gp/product/B00CMTF8XQ my $url = shift @ARGV; die "No URL specified on command line.\n" unless defined $url && length $url; my $html = get $url; my $finder = URI::Find->new( \&callback ); my $found = $finder->find( \$html ); # gebe erste gefundene URL aus say first { /1500_.jpg$/ } @urls;