Remove Duplicate Lines from a File - perl
Copy this code and paste it in your HTML
#!/usr/bin/perl
use strict;
use warnings;
my $file = '/path/to/file.txt';
my %seen = ();
{
while(<>){
$seen{$_}++;
next if $seen{$_} > 1;
}
}
print "finished processing file.";
URL: http://www.daniweb.com/code/snippet631.html
Report this snippet
Comments
Subscribe to comments