in reply to How to copy an array to a hash?

I'm not sure what you're really trying to achieve with this, but let's make sure you know how arrays get assigned to hashes.
my @array = (1, 2, 3, 4, 5, 6); my %hash = @array;
Is the same as saying:
my %hash = ( 1 => 2, 3 => 4, 5 => 6 );
apart from not having an @array floating around in the second version of course. If you really want to get each non-empty line in your input file into a hash with a key that's generated by some iterative process, you want something like
open my $file, '<', $filename or die "Unable to open '$filename': $!"; my %edit; for (<$file>) { next if //; chomp; # Some code to get a $key with an appropriate value $edit{$key} = $_; } close $file;