use IO::File; my $file = IO::File->new('>carddb.txt') or die $!; #### use LWP::Simple 'get'; use strict; use warnings; my $basePath = "http://ww2.wizards.com/gatherer/CardDetails.aspx?id="; for(my $i = 1; $i < 129700; ++$i){ print STDOUT "Getting $i ... "; my $content = get($basePath.$i); print STDOUT "Done\n"; if($content){ $content =~ m/((?:\w|\s)+)<\/span>/; my $result = $i.';'.$1."\n"; print STDERR $result; print STDOUT $result; }else{ print STDOUT 'Failed on ', $i, "\n"; } sleep 1; } print STDOUT "Done!\n";