in reply to Just between you, me and subroutines

One isssue being pointed out is that your subroutines get() and login() are defined within your SUBMIT() subroutine. I can't think of a good reason for that. Your indentation makes it difficult to see that that is whats going on. Try indenting like this: (i copied your SUBMIT function, and just indented it.)
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; }
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.
Another issue i'd like to bring up is that you are not useing strict or warnings, which will only bite you in the end.

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.


I use the most powerful debugger available: print!