Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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 = ''; 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

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://944136]
[marioroy]: I also have a Hobo driver for Forklift allowing folks to use in multiple classes, no conflicts with one another. That's not possible for P::FM.
[Discipulus]: congrats marioroy!
[marioroy]: CORE::wait works well eventhough multiple instances or classes using Hobo::Manager.
[Corion]: marioroy: I'm not sure what the normal use for the PID is in P:FM, but I guess that most programs just ignore or log it
[Corion]: Oh, yes, programs could call wait $pid, but if your $pid is an object, then you could add a ->wait method to it and wait $pid would call that automatically "thanks" to indirect object notation
[marioroy]: Just documentation edits is all that remains. Hobo::Simple provides foreach and forseq with identifier capability -- all transparently supporting array, hash, file handle, and seq 1 .. N.
[marioroy]: Corion Regarding PID, that's great. So will leave it so compatible with MCE::Hobo. e.g. ->create returns a Hobo object. Folks can get ->pid from it. So, that's not a problem.
[choroba]: ad readdir: 5.12 needed
[marioroy]: CORE::wait can block if another process reaps a worker from another class. MCE::Hobo takes care of that and transparently.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2017-05-26 08:44 GMT
Find Nodes?
    Voting Booth?