#!/usr/bin/perl use strict; use warnings; print "What is the name of the access rights .csv? (Full file name)\n"; my $file = <>; print "Is there a header in this file?\n"; my $header = <>; if ($header =~ m/^yes|^y]/i){ $header = "1"; } else {$header = "undef"; } print "What file format are your messages in?\n"; my $format = <>; open (CSV, "<", $file); my (@emailList, @domain, %userHash); while (my $currow = ){ if ($header || $currow =~ m/^email|^e-mail/i){ @domain = split (',', $currow); shift @domain; $header = "undef"; } if($currow =~ m/[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3}))$/){ for my $i (0..$#domain){ my @currow = split (',', $currow); if ($currow[$i+1]) { $userhash{$currow[0]}{$domain[$i]} = 1; } else{ $userhash{$currow[0]}{$domain[$i]} = "undef"; } push (@emailList, $currow[0]); } } else{ print STDERR "This email address isn't properly formatted! $!\n" } }