while () { next unless ( /^(.+)\s(http:\/\/\S+)\s+(.+)$/ ); # just skip unusable lines my ( $NAME, $URL, $ALT ) = ( $1, $2, $3 ); $http->reset; if ( $http->request( $URL ) != 200 ) { warn "cannot read from $URL ($NAME)\n"; next; } if ( http->body() =~ /.../ ... ) { my $IMGURL = $1; ... $http->reset; if ( $http->request( $IMGURL ) != 200 ) { warn "drat! tried to get $IMGURL (for $NAME) but couldn't\n"; next; } # OK, got the image... and so on... } } #### my %name; my %alt; my %bad; while () { if ( /^(.+)\s(http:\/\/\S+)\s*(.+)$/ ) { $name{$2} = $1; $alt{$2} = $3; } else { $bad{$.} = $_; } } close CONF; if ( keys %bad ) { warn "unusable config data at line $_:\n $bad{$_}" for ( sort { $a <=> $b } keys %bad; } warn "Loading ",scalar( keys %alt )," comic sites\n"; for ( keys %alt ) { # ... and so on }