http://www.perlmonks.org?node_id=944136


in reply to What is the problem with my script?

Your code, fixed:

#!/usr/bin/perl -w use strict; use warnings; use LWP::Simple; my $data_file="common.txt"; open DAT, '<', $data_file || die "Could not open file!"; my @raw_data=<DAT>; close(DAT); # set once outside loop, not each time around my $url = 'http://rscript.org/lookup.php?type=namecheck&name='; foreach my $name (@raw_data) { chomp $name; #my $name = $name; # ??? set above #print "$url$name\r\n"; #my $content = ("GET", '$url$name'); get is a function from LWP::Sim +ple #my $content = ("GET", '$url$name'); $url$name in single quotes is t +hat exact text my $content = get("$url$name"); die "Couldn't get $url$name" unless defined $content; if($content =~ "NAMECHECK: NOTAVALIBLE") { print "\"$name\" is niet beschikbaar\n"; } if($content =~ "NAMECHECK: AVALIBLE") { print "\"$name\" is beschikbaar\n"; } } __END__ "jj" is niet beschikbaar "jakejake" is niet beschikbaar "blowmeuptom" is beschikbaar "bilderberger" is niet beschikbaar "rothchild" is niet beschikbaar "ronaldmcdonald" is niet beschikbaar