p...@highdeck.com wrote:
Hi john,
Hello,
thanks for the prompt reply.
Ok, here's what I'd like it to do.
#!/usr/bin/perl
#
# Build Initial list and put into array.
@serverlist = `/usr/bin/wget -q -O - http://www.amazon.co.uk`;
for ($index = 0; $index <= $#serverlist; $index++) {
#replace http with newline, all .com etc should now be in 3rd field "/"
$serverlist[$index] =~ s/http/\n/g;
print $serverlist[$index];
}
Now, if I run this as above and pipe it to grep thus
./webprog.pl |grep ://|cut -d"/" -f3
Then I get...
ecx.images-amazon.com
ecx.images-amazon.com
g-ecx.images-amazon.com
g-ecx.images-amazon.com
g-ecx.images-amazon.com
g-ecx.images-amazon.com
www.amazon.com">United States<
www.amazon.de">Germany<
www.amazon.fr">France<
BUT, I want to do it all in perl itself,
use LWP::Simple;
use Regexp::Common;
my @hosts = map m[https?://([^/]+)/], get( 'http://www.amazon.co.uk/' )
=~ /$RE{URI}/g;
print "$_\n" for @hosts;
John
--
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/