open INPUT, '<', 'theFileName'; #### print "$_ found in lines: @{$counter{$_}}\n" for sort keys %counter;