in reply to building a hash with filname and itscontents
For a start it doesn't use strictures (use strict; use warnings).
You may find changing
@$spr_hash{$file_name} = <FH>;
to
@{$spr_hash{$file_name}} = <FH>;
helps. The following sample script would have shown the problem more clearly:
use strict; use warnings; use Data::Dumper; my $file_name = 'test.txt'; my %spr_hash; $spr_hash{$file_name} = []; @$spr_hash{$file_name} = qw(1 2 3); print Dumper [ %spr_hash ];
|
|---|