vihar has asked for the wisdom of the Perl Monks concerning the following question:
I am only supposed to be considering following since 30 is repeated for 2 more lines.AB000000026JHAHKDFK AB000000028JHKHKHKJ AB00000003033AFSFAS AB000000030HJHKH80J AB000000030LOIKJUJ8 AB0000000324446KJHK
Here is my code:AB000000026JHAHKDFK AB000000028JHKHKHKJ AB00000003033AFSFAS AB0000000324446KJHK
I am stuck in that last foreach loop as I am not sure what I can do. Like I mentioned, I am performing other functions to these lines. But I am just having trouble with avoiding these lines with repeated unique codes. I want this code to be able to move over to next line if same unique code is found.use DBI; use Time::localtime; use File::Compare; use XML::Simple; # qw(:strict); use Data::Dumper; $user = "213256"; @fileRead = glob '/export/home/$user/Tests/Match/dummy2*'; my @array1; foreach $file (@fileRead){ open(FILE, $file) or die "Can't open `$file': $!"; @lines = <FILE>; close FILE; foreach $line ( @lines ) { $str = $line; $var = substr($str, 10, 2); push(@array1, "$var"); my @unique = grep { ! $seen{$_}++ } @array1; } ...... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Removing duplicates lines
by zork42 (Monk) on Sep 04, 2013 at 19:45 UTC | |
by Not_a_Number (Prior) on Sep 04, 2013 at 20:15 UTC | |
by zork42 (Monk) on Sep 05, 2013 at 12:01 UTC | |
by vihar (Acolyte) on Sep 04, 2013 at 20:33 UTC | |
|
Re: Removing duplicates lines
by Eily (Monsignor) on Sep 04, 2013 at 22:04 UTC | |
|
Re: Removing duplicates lines
by mtmcc (Hermit) on Sep 04, 2013 at 19:34 UTC | |
by vihar (Acolyte) on Sep 04, 2013 at 19:41 UTC | |
|
Re: Removing duplicates lines
by Laurent_R (Canon) on Sep 04, 2013 at 21:15 UTC | |
|
Re: Removing duplicates lines
by locked_user sundialsvc4 (Abbot) on Sep 04, 2013 at 22:34 UTC | |
by vihar (Acolyte) on Sep 05, 2013 at 12:40 UTC |