in reply to eliminating duplicates with filters

[ Use <p> to mark the start of paragraphs, and wrap computer text and other preformatted text using <c>...</c>. ]

while (<>) { my ($key) = /^(..)/s; print if !$seen{$key}++; }

Replies are listed 'Best First'.
Re^2: eliminating duplicates with filters
by snow28 (Initiate) on Feb 08, 2011 at 01:00 UTC
    Hi, thanks for the reply.. Actually I am reading that array data from a text file so how can I apply it there?? I think I have to first identify the ID elements in the text through pattern matching, then eliminate all duplicate ID's and their corresponding sequence. but here 1f:a & if:b are duplicate IDs too i.e data after colon (:) isn't considered so they both are considered as same id and duplicates has to be eliminated. Hope I am clear now !! please help me with it.. Thanks in advance
      If you want to loop over an array instead of a text file, replace
      while (<>) {
      with
      for (@array) {