use strict; use warnings; use Data::Dumper; use XML::Simple; use LWP::Simple; our $URL = 'http://www.perlmonks.org/index.pl'; our $PATH = '/path/to/perlmonks/nodes'; for (0 ... 666666) { my $node = get "$URL?node_id=$_&displaytype=xml"; my $xml = XMLin($node); next if $xml->{title} =~ /Permission\s+Denied/i; next if $xml->{title} =~ /Not\s+found/i; open FH, '>', "$PATH/$_.xml" or die "can't write: $!"; print FH $node; sleep 5; # play nice ;) }