in reply to Broken Dilbert archive script using LWP::Simple

I'm working on the same problem for my wife: pull down the daily Monty strip.

I'm trying a paired down version of code (found here) and then altered to send it to her inbox. Thing is, the script only works about 1/5th of the time. The other four times it delievers nothing, or an old image.

I'm not sure if it's because the regexp I'm doing is off, or if the site has a way of knowing I'm doing an image pull like this.

At any rate, I'm hoping to get it solved today. I'm working towards building a search agent in perl, and this is one of my first steps.

Here's the code I'm using:
#! /usr/bin/perl -w #use LWP::Simple; #$url = "http://www.unitedmedia.com/comics/monty/"; #$url = get($url); #$url =~ /<img src=\"\/comics\/monty\/archive\/images\/(monty\d+\.gif) +\"/; #getstore("http://www.unitedmedia.com/comics/monty/archive/images/$1", +"../$1"); #$url = "http://www.unitedmedia.com/comics/monty/archive/images/$1"; #print $url; #send_mail('emailaddy@here.com', 'sender@here.com', 'Your comic', $url +); # #sub send_mail { # my($to, $from, $subject, $body)=@_; # my $sendmail="/usr/lib/sendmail -t"; # open (MAIL, "|$sendmail") || die "Can't start sendmail: $!"; # print MAIL<<END_OF_HEADER; #From: $from; #To: $to; #Subject: $subject; # #END_OF_HEADER # foreach ($url) { # print MAIL "$_\n"; # } # close(MAIL); #}