#!/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$username"; 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"; }