Skip to content

Instantly share code, notes, and snippets.

@adriaandens
Created February 23, 2013 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adriaandens/5020340 to your computer and use it in GitHub Desktop.
Save adriaandens/5020340 to your computer and use it in GitHub Desktop.
Elective.pl
use warnings;
%courses = (
"2CPR2B" => "C Language",
"1UNX1B" => "Intro to UNIX",
"3SH414" => "Shell Programming",
"4PL400" => "Perl Programming"
);
#Sorteren op key values:
foreach $key (sort keys %courses) {
print "$key: $courses{$key}\n";
}
print "\nEnter the code for the course you wish to follow.";
chomp($yourCourse = <STDIN>);
while(($key,$value) = each(%courses)) {
if($key eq $yourCourse) {
print "You will be taking $value this semester.";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment