-
-
Save TyOverby/3950403 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use LWP; | |
# $prerequisites->{course}->{requirement} | |
my $prerequisites = {}; | |
my $ua = LWP::UserAgent->new(); | |
my $response = $ua->get("http://www.washington.edu/students/crscat/cse.html"); | |
die "Error: ", $response->status_line unless $response->is_success; | |
foreach my $line (split /^/, $response->content()) { | |
next unless $line =~ /^<P><B><A NAME="(cse\d{3})">(CSE \d{3}) <\/A> ([\w\s]+) \((\d+)\) <\/B><BR>(.+) Prerequisite: ([^\.]+)/; | |
my $short_name = $1; | |
my $course = $2; | |
my $name = $3; | |
my $credits = $4; | |
my $description = $5; | |
print "Code:\t$1\n"; | |
print "Course:\t$2\n"; | |
print "Name:\t$3\n"; | |
print "Credits:\t$4\n"; | |
print "Description:\t$5\n"; | |
print "Prerequisite:\t$6\n\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment