#!/usr/bin/perl use warnings; use strict; use DB_File; use POSIX; my $dbase = "dbase.db"; my %dbase; tie (%dbase, 'DB_File', $dbase, O_CREAT|O_RDWR, 0644) || die "Died tying database\nReason: $!\n"; my $dict = "dictionary.txt"; my $saved = "saved.txt"; #foreach (keys %dbase) #{ print "$_ => $dbase{$_}\n ."; } #exit; my $search = "https://www.godaddy.com/gdshop/default.asp"; open(DICT, $dict) or die "Cannot open $dict because $!"; my $words = ; my @words = split(/ /, $words); close(DICT) or die "Cannot close $dict because $!"; if ($ARGV[0] =~ m/con/i) { my $start = $dbase{"word"}; shift @words until $words[0] =~ m/$start/; print "con found!\n"; } my $count = -1; open(SAVED, ">>$saved") or die "Cannot open $saved because $!"; foreach my $word (@words) { $count++; print "Searching $word..\n"; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get($search); $mech->submit_form( form_name => "LookupForm", fields => { domainToCheck => "$word" } ); $dbase{"word"} = "$word"; my $results = $mech->content; if ($results =~ m/This domain name IS AVAILABLE/i) { print SAVED "$word.com\n"; print "\t $word AVAILABLE!\n\a"; } else { print "\t $word TAKEN\n"; } } close(SAVED) or die "Cannot close $saved because $!"; untie %dbase;