my @files = ('tab1.txt','tab2.txt'); # Or, using the "quote-word" function "qw", # which lets you omit the quotes and the comma: my @files = qw( tab1.txt tab2.txt ); #### my $hash_key =~ s/\.txt//; # generate hash key #### Use of uninitialized value in substitution (s///) at merge.pl line 16. #### (my $hash_key = $file) =~ s/\.txt//; # generate hash key #### $ptables{$hash_key} = [ @string_array ]; # save all strings to the hash print Dumper(\%ptables); # use "\" to pass reference of hash