All pastes #2093439 Raw Edit

Untitled

public text v1 · immutable
#2093439 ·published 2011-11-09 21:55 UTC
rendered paste body
#!/usr/bin/perl
use strict;

my $malefile = "malefirst.txt";
my $femalefile = "femalefirst.txt";
my $lastfile = "alllast.txt";
my $domain = "\@eastcentral.edu";

my $gender_choice = 0;
my $num_of_male = 5;
my $num_of_female = 5;

my @male;
my @female;
my @last;
my $rand1;
my $rand2;

open(MALE, "<", $malefile) || die $!;
open(FEMALE, "<", $femalefile) || die $!;
open(LAST, "<", $lastfile) || die $!;

while (<MALE>){
        push @male, [split /\n/];
}
while (<FEMALE>){
        push @female, [split /\n/];
}
while (<LAST>){
        push @last, [split /\n/];
}

if ($gender_choice == 0) {
        for (my $i = 0; $i < $num_of_male; $i++){
                $rand1 = int(rand($#male - 1));
                $rand2 = int(rand($#last - 1));
                my $fname = $male[$rand1];
                my $lname = $last[$rand2];
                print "$fname$lname$domain\n";
        }
} elsif ($gender_choice == 1) {

} else {

}