You gotta love perl don't you. A dozen lines (with error handling!) If you want to get a login and learn some perl then I'm sure the monks will be more than willing to help you to say read in a list of usernames from file using open() and the input operator, get their year data, build a data structure, sort() the results by year and then print() the results to your screen or a file which is presumably what you have in mind. You can find out how to do all this using Tutorials and Super Search right here.
#!/usr/bin/perl -w use strict; use LWP::Simple; my $username = 'dgarcia'; $username =~ s/(\W)/ uc sprintf "%%%02x", ord $1 /eg; # url encode non + alpanumerics my $url = "http://web.mit.edu/bin/cgicso?query=username%3D$usernam +e"; my $page = get($url); if ($page =~ /No matches to your query/) { warn "User '$username' could not be found!\n"; } else { my ($year) = $page =~ m/year:\s*(\d+)/; warn "Could not find year for user '$username'\n" unless defined $ +year; print "User $username is in year $year\n"; }
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Open Page
by tachyon
in thread How to load and view and HTML page from perl (was: Open Page)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |