in reply to Use LWP::Simple to download images from a website

You wrote:
> # this bit assumes the numbers of the files are zero > # padded to three zeroes... there is surely a better > # way to do this > my $f = substr("000".$i,-3,3);
You were right, there is. :) Use sprintf:
my $f = sprintf "%03d", $i;
By the way, you might want to take a look at Image::Grab. Give it a web page URL, it'll grab it, parse it and look for images, and grab the images.

Replies are listed 'Best First'.
Re: Re: Use LWP::Simple to download images from a website
by zeno (Friar) on Jan 17, 2001 at 15:35 UTC

    Thanks, btrott! I've changed the number padding bit to use sprintf (doh!).

    This script is a little different from what I understand Image::grab to do. My script isn't set up to get images based on them being part of a web page. It's really so that someone with permission can download a sequence of images, like if a business partner shares all his or her product images with you, and tells you just to get them from the image directory on his or her web page.

    Thanks again! -tim