in reply to Just between you, me and subroutines
With that indentation, its easy to see that you are missing the closing '}' in the else, which is why you need the final one at the end of your code.sub SUBMIT { my $login = 1; my $ua = LWP::UserAgent->new(%uaoptions); $ua->cookie_jar( {} ); if ($login) { &login; } my $logintest= get("http://www.site.com/"); if ($logintest =~ m!you are now logged!sim) { } else { print "Bad username or password."; exit; }
Also, you could benefit from passing variables into your subroutines, instead of having globals.
I don't mean to bash your code, for the most part it looks like you're on the right track. As you said, you're pretty new to this, and myself and the other comments are trying to keep you from getting into some bad habits that will hinder you in the end.
Good luck, hopefully we can be some help to you.
|
|---|