Malcolm Mill wrote:
Hi, Can anyone help me with this.
I'm using wget, a perl script and a shell script to download files from serveral directories on a web server.
The URLs I'm passing to wget are of the form:
http://www.foo.br/001/ - http://www.foo.br/050/
My perl script loops through the numbers 1-50, inserting each iteration in a string representing the URL. I call it from my shell script and redirect output to a text file. I then call wget from the same shell script passing the name of this text file to wget's --input-file option.
This depends a little on what options you're passing to wget. Do you wish to just get the file? In which case LWP::Simple might be suitable.
#!/usr/bin/perl -wT use strict; use LWP::Simple;
my $url = "http://search.cpan.org/~gaas/libwww-perl-5.800/lib/LWP/Simple.pm";
my $file = "LWP::Simple_Documentation.html";
my $response = getstore($url, $file);
I want to do this all in Perl and avoid messing around with shell scripts or batch files.
Also, is there a simple way of constructing the numbers 001-050 for my URL strings?
Use sprintf.
foreach (1..50) { print sprintf("%03d", $_); }
All the best,
Jacinta
-- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | [EMAIL PROTECTED] | (il),-'' (li),' ((!.-' | www.perltraining.com.au |