#!/usr/bin/perl my @names = qw(x.txt l.txt m.txt); my $random_file = $names[rand @names]; if($random_file eq "l.txt") { open FILE, "l.txt" or die "Error Opening: Cannot open file!"; @emails = ; close FILE; $email = $emails[int(rand($#emails +1))]; chomp($email); print "$email\n"; }elsif($random_file eq "x.txt"){ open FILE, "x.txt" or die "Error Opening: Cannot open file!"; @emails = ; close FILE; $email = $emails[int(rand($#emails +1))]; chomp($email); print "$email\n"; }elsif($random_file eq "m.txt"){ open FILE, "m.txt" or die "Error Opening: Cannot open file!"; @emails = ; close FILE; $email = $emails[int(rand($#emails +1))]; chomp($email); print "$email\n"; }