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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.