First of all, it would be helpful to see your input data.
I'm not very familiar with the CSV module, because parsing CSVs is something that Perl does very well natively.
Everything is fine up until the
my $csv = Text::CSV->new();
At that point you should probably be doing:
open (CSV, "<", $file) or die $!;
my %subhash;
for my $line ( split "\n" ) {
my( $key, $value ) = split /\s+;\s+/, $line;
$subhash{ $key } = $value;
}
$hash{ $subhash{ $file } } = \%subhash;
}
This is nearly identical to a question answered by
BrowserUK in this node:
creating hash of hashes from input file