in reply to Re^2: retrieving in the correct order
in thread retrieving in the correct order

Well, some detail on what went wrong would help....

When I tried it against the sample data in your original post, I noticed two things:

  1. You're testing for gi| at the beginning of the line, but your @array1 values start with >gi|. I had to remove the >; you'll have to either fix the $key = line to match your data, or fix the data to match your test...
  2. You're populating a single element in array2. If you want each number to be an element of the array, you need to use qw(...), not qq(...).

If these are both copy-and-paste artifacts, pleave provide more detail on what the error is.

Replies are listed 'Best First'.
Re^4: retrieving in the correct order
by Anonymous Monk on Dec 16, 2004 at 21:24 UTC
    Sorry,

    I should have been more specific.

    The two problems that you noticed are not problems in my program, just in the example I gave in my question.

    With the code that you posted I don't get any error - but I don't get any output either ;-( The $key is definately picking up values (e.g. gi|14028145 |) so I think the problem is with substr. Also, the values of @array2 are present in @array1 as I have checked.

    Hope you can help.

    Thanks!

        Infact, I was not using either qq or qw - the values come from earlier in the script. I tried your test and the array has exactly the amount of elements that I thought.