Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: What is the problem with my script?

by keszler (Priest)
on Dec 17, 2011 at 22:32 UTC ( #944136=note: print w/ replies, xml ) Need Help??


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


Comment on Re: What is the problem with my script?
Download Code
Re^2: What is the problem with my script?
by Jan Jaap (Initiate) on Dec 19, 2011 at 15:53 UTC
    Thanks for the help everyone. It's indeed a player name checker and not a domain checker. I'll try out the edited code someone posted. Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://944136]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2015-07-06 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls