in reply to Re: remove duplicates with hash and grep
in thread remove duplicates with hash and grep
Change it to this and am now getting the list but it has not removed the duplicates. Still lost
#!/usr/bin/perl use warnings; use strict; my $upload = "/var/tmp/work/upload"; my $work = "/var/tmp/work/STAP-domain_clean_project"; my $input3 = "$upload/domain.csv"; system ("dos2unix $input3"); open (IN,"$input3"); open (OUT,">>$work/local.rules"); while (<IN>) { chomp(); if ($_ =~ /^.+\.([A-Za-z0-9-_]+\.[A-Za-z]{2,})$/){ my @array = $1; my %seen = (); my @unique = grep { ! $seen{ @array }++ } @array; print "@unique\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: remove duplicates with hash and grep
by GotToBTru (Prior) on Dec 22, 2014 at 22:18 UTC | |
by Smith (Initiate) on Dec 23, 2014 at 15:19 UTC | |
|
Re^3: remove duplicates with hash and grep
by AnomalousMonk (Archbishop) on Dec 23, 2014 at 04:25 UTC |