#! /usr/local/bin/perl

# 6.838
# Created by Justin Legakis (legakis@graphics.lcs.mit.edu) for Fall 1996
# Modified by Jon Levene (jslevene@graphics) for Fall 1997

# Create list of email addresses of all students

$datapath="../data";


opendir(THISDIR, $datapath);
@allfiles = grep(!/^\.\.?|(.*)\.html.?|(.*)~/, readdir(THISDIR));
closedir(THISDIR);


foreach $file (@allfiles) {

  open(FILE, "$datapath/$file") || die "can't open file $file\n";
  @lines = <FILE>;

  @email[0] = @lines[4] =~ /^email: (.*)$/;

  # in case someone doesn't add the "@mit.edu":
  ($uid, $domain) = split(/\@/, @email[0]);
  if ($domain eq "") {
	@email[0] = "@email[0]@mit.edu";
  }

  print "@email[0]\n";
}



