in reply to adding text from different txt file into hash

Very blind and weird-looking:
open( FILE1, "file1.txt" ) or die "Unable to open file1.txt\n$!\n"; open( FILE2, "file2.txt" ) or die "Unable to open file2.txt\n$!\n"; my %hash; @hash{ map{ chomp; $_ } <FILE1> } = map { chomp; $_; } <FILE2>
Print to the third file as any of the above.

Replies are listed 'Best First'.
Re^2: adding text from different txt file into hash
by holli (Abbot) on Apr 20, 2005 at 21:44 UTC
    similar
    use File::Slurp; my %h; @h{map{chomp;$_}read_file("test1.txt")}=(map{chomp;$_}read_file("test2 +.txt"));


    holli, /regexed monk/