in reply to print out duplicate records

This is untested, but it ought to do the trick, and it has the added bonus of not having to read 4 megs of text into memory all at once.

#! /usr/bin/perl use strict ; use warnings ; $|++ ; open(CDR, $CDR); open(SORTED_CDR, ">$SORTED_CDR"); open DUPS, 'dup_records.txt' ; #@ARRAY=<CDR>; #my @unique = do {my %h; grep {!$h {$_} ++} @ARRAY}; my %seen = () ; while ( <CDR> ) { if ( $seen{$_}++ ) { print DUPS $_ ; } else { print SORTED_CDR $_ ; } } #print SORTED_CDR @unique; exit ; __END__

_______________
D a m n D i r t y A p e
Home Node | Email