
#!/usr/bin/perl
use MoodleUtils;
while(<>) {
chomp $_;
my ($username,$fname,$sname,$email) = split /,/, $_;
my $userID = getUserID($username);
if($userID > 0) {
updateUser($userID,$username,$fname,$sname,$email);
}
else {
my $password = int(rand(5100000));
insertUser($username,$fname,$sname,$email,$password);
sendNewAccountEmail($email,$username,$password);
}
}