while () { $row = $_; ($pnr, $enamn, $fnamn, $adress, $stad, $telnr, $ar, $lon, $timmar, $anr) = split("\t", $row); for ($i = 0; $i < $cnt; $i++) { if($pnr_array[$i] eq $pnr) { $duplicate++; $unique = 0; print "\n$pnr is not unique!\n"; } } if ($unique != 0) { $pnr_array[$cnt] = $pnr; $cnt++; # file write code omitted.. } $unique = 1; } #### while () { $rad = $_; ($pnr, $enamn, $fnamn, $adress, $stad, $telnr, $ar, $lon, $timmar, $anr) = split("\t", $rad); # print "$pnr"; if(exists $pnr_array{$pnr}) { $duplicate++; $unique = 0; print "\n$pnr är inte unikt!\n"; } if ($unique != 0) { $pnr_array{$pnr} = 0; } $unique = 1; }