[Bioperl-l] how-to-remove-redundant-lines

Terry Jones tcj25 at cam.ac.uk
Wed Jun 29 06:30:28 EDT 2005


Oops......  I wrote the following rubbish:

| Are there any constraints on your data that might help solve this?
| 
| For example, do the numbers always have exactly one space between
| them? Do the numbers always appear in ascending order? Is there ever
| any trailing whitespace on a line (there was a space at the end of
| your second line).
| 
| If the answers to the above are yes, yes, and no, then the following
| works. If not, you'll need to do a little more to canonicalize each
| line (e.g., strip spaces, sort the numbers, etc).
|
| [Incriminating / embarrassing perl deleted]

My code has at least two serious errors: 1) as Heikki points out, you
can't output anything until you've read all the data, and 2) it will
give spurious matches in input cases like this

  23 45 67
   3 45

I hereby disown my earlier posting. You should follow Heikki's advice
and use sets.

Terry


More information about the Bioperl-l mailing list