in reply to Where did I go wrong?

You are hiding errors by not using use strict;. One is that $filename is neither declared nor initialized.

open( FILE, "< /tmp/blah.txt" ) or die "Can't open $filename : $!";

should be

my $filename = '/tmp/blah.txt'; open( FILE, '<', $filename ) or die "Can't open $filename: $!\n";

By the way, you might want to use HTTP::Request::Common instead of building the query manually.

Replies are listed 'Best First'.
Re^2: Where did I go wrong?
by sjlo (Initiate) on Nov 13, 2007 at 22:29 UTC
    ok..here are the errors... unmatched right curly bracket at c:\users\xxx\perl\script.pl line 17, at end of line syntax error at line 17, near "}" execution aborted due to compilation errors
      That error does not exist in the code you gave us.
        it's the error I received when I tried to run it :/ here is exactly what i have now..
        #!/usr/bin/perl -w use LWP::UserAgent; my $digits; my $filename = '/tmp/blah.txt'; open( FILE, '<', $filename ) or die "Can't open $filename: $!\n"; $digits = $_; print "Attempting line: " . $digits; k_go_now($digits); # Sleep to keep us slightly more hidden and load off their servers sleep(1); } # k go now sub; grabs input from file ($username, $password) tries to +login sub k_go_now { my ($digits) = @_; $ua = LWP::UserAgent->new; $ua->agent("MyApp/0.1 "); # Create a request my $req = HTTP::Request->new(POST => 'https://xxx.com'); $req->content_type('application/x-www-form-urlencoded'); $req->content('query=libwww-perl&mode=dist'); # Pass request to the user agent and get a response back my $res = $ua->request($req); # Check the outcome of the response if ($res->is_success) { check_output ($res->content); } else { print $res->status_line, "\n"; } } # suib check_output checks the response from the website and if it's a +ny good sub check_output { my ($output) = @_; if ($output =~ /Login Failed/) { print "Nope, failed login\n"; } elsif ($output =~ /Login Successful/) { print "got'em with login details\n"; } else { print "unknown response !!!\n$output\n\n"; } }