print "What is the name of the access rights .csv? (Full file name)\n"
+;
my $file = <>;
That would be better written as:
print "What is the name of the access rights .csv? (Full file name)\n"
+;
chomp( my $file = <STDIN> );
print "Is there a header in this file?\n";
my $header = <>;
if ($header =~ m/^yes|^y]/i){
$header = "1";
}
else {$header = "undef";
}
At this point $header will ALWAYS be true. I think you meant $header = undef; instead of $header = "undef";.
open (CSV, "<", $file);
You should always verify that the file opened correctly before trying to use an invalid filehandle.
open CSV, '<', $file or die "Cannot open '$file' because: $!";