in reply to Re^3: hashes with multiple values per key
in thread hashes with multiple values per key

oh sorry! printing the wrong thing. i get this:
'c3638256-3637330 ' => 'nonisland', 'c5186660-5185929 ' => 'island', '2492050-2492826 ' => 'nonisland', 'c2912723-2911074 ' => 'nonisland', '4270483-4271283 ' => 'nonisland', 'c3382955-3382149 ' => 'nonisland', 'c50327-49533 ' => 'nonisland', '5593618-5594448 ' => 'nonisland', 'c2175920-2175063 ' => 'nonisland', 'c3251621-3250926 ' => 'nonisland', 'c73634-72498 ' => 'plasmid', 'c3426507-3423520 ' => 'nonisland', '5978831-5980213 ' => 'nonisland', 'c599874-598564

Replies are listed 'Best First'.
Re^5: hashes with multiple values per key
by lima1 (Curate) on Apr 04, 2006 at 10:34 UTC
    ok, I can't see the keys 1 and 138, which you would need for the Dumper output of %hash. check @gp_ids and @plasmid_ids. what should be the output? hard to help you as we can't know what your code should do.
      Hi there,

      The output should be like this:

      plasmid-plasmid 35 island-plasmid 2 nonisland-island 5 etc
      I basically have two lists of paired numbers (in @part1 and @part2), I want to find out where each number in the pair is from (island, plasmid, non-island) based on whether there ids are in the corresponding arrays. I finally want to match each pairs locations (e.g. plasmid-island) to their pair identifier (a number), which are stored in @gp_ids.

      Thanks!

        ok, then simply this?
        while (my($k,$v) = each %hash) { print "$map{$k}-$map{$v->[0]} $v->[1]\n"; }