Hi

I'm almost totally new to Perl! :-)
I need to write a program that search a CDR file for duplicate lines and then delete them.

This is what I have found out by reading in the Perl documentation and this newsgroup, but I need a little more help.


I found this program in this newsgroup:

---------------
#!/usr/bin/perl

my $in_file  = '/path/my_in_file';

open my $in,  '<', $in_file     or die "Cannot open '$in_file' $!";
open my $out, '>', 'scripted_out_file' or die "Failed to script file for duplicates $!";

my %hash;

while ( <$in> ) {
     my $key = join ',', ( split /,/ )[ 2, 3, 6, 7 ];
     print $out $_ unless $hash{ $key }++;
     }

close $out;
close $in;
---------------

This program should take out the cells 2, 3, 6 and 7 in a file split by comma. My CDR file is split by space.

How can I use 'readline EXPR'?
Any help?... it's probably pretty simpel :-)

..//Henrik


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to