Help for this page
$ cat infile1.txt line1 ... line3 line4 line2
#!/usr/bin/perl use strict; ... map { chomp; $hash{ $_ }++ } <IN>; close($in); print Dumper \%hash;
Output: $VAR1 = { ... 'line4' => 1, 'line1' => 2 };