baseball.pl

#! /usr/bin/perl
use strict;
use warnings;

my @scores;
for(my $i = 0; $i < 9; $i++) {
  my $in = $i + 1;
  print "Inning $in score?\n";
  chomp(my $score = <STDIN>);
  $scores[$i] = $score;
  print "Scores: @scores\n";
}

login.pl

#! /usr/bin/perl
use strict;
use warnings;

my(%users) = (
  'alan' => 'test',
  'bob' => 'foo',
);

while(1) {
  print "Please log in\nUsername:\n";
  chomp(my $username = <STDIN>);
  print "Password:\n";
  chomp(my $password = <STDIN>);
  if(not exists $users{$username}) {
    print "Invalid username!\n";
    next;
  }
  if($users{$username} ne $password) {
    print "Invalid password!\n";
    next;
  }
  print "(a)dd or (r)emove a user?";
  chomp(my $cmd = <STDIN>);
  if($cmd eq 'a') {
    print "Username to add:\n";
    chomp(my $newuser = <STDIN>);
    print "Password to add:\n";
    chomp(my $newpass = <STDIN>);
    $users{$newuser} = $newpass;
  } elsif($cmd eq 'r') {
    print "Username to remove:\n";
    chomp(my $olduser = <STDIN>);
    delete $users{$olduser};
  } else {
    print "Unknown command\n";
  }
  print "\n\n";
}

netflix.pl

#! /usr/bin/perl
use strict;
use warnings;

my(@starting_queue) = ("12 Monkeys", "Time Bandits", "Brazil");

my @queue = @starting_queue;

while(1) {
  print "Here is your current movie queue:\n";
  for(my $i = 0; $i < @queue; $i++) {
    print "    $i. $queue[$i]\n";
  }
  print "(s)hip next or movie name to add\n";
  chomp(my $cmd = <STDIN>);
  if($cmd eq 's') {
    my $next = shift @queue;
    print "Shipping you $next\n";
  } else {
    print "Adding $cmd to end of queue\n";
    push @queue, $cmd;
  }
}