
BillKSmith
Veteran
Oct 27, 2010, 3:45 PM
Post #26 of 26
(979 views)
|
|
Re: [Jeff29] Parsing a text file and outputting to an excel sheet
[In reply to]
|
Can't Post
|
|
The syntax for uniq is: uniq LIST It returns a list with duplicates removed from the argument list. There is a clever idiom that allows you to keep track of items you have already seen (or printed).
my %seen; print $cr_line, $match, $resolution_link, "\n" if ! $seen{$cr_line}++ ; The hash declaration must be before any loops which include the print. When the loop completes, the hash contains the number to times each line was seen (only the first of each was printed). It is fun to try and figure out how this works. Good Luck, Bill
|