What you need is a matrix, as a data structure to store the mappings in. In Perl, this can be done easily with a hash of hashes.

Here's a code sample that should get you started: It reads in a single file from the DATA section, parses the mappings with a regular expression and stores them in a matrix.

The following for loops are iterating through the matrix, printing out the mappings.

Just repeat this for all of your files and add some code to produce a comma separated format, suitable for your spreadsheet program.

my $data = join '', <DATA>; my $matrix = {}; while($data =~ /"(\d+) \s+ \( (\w+)v(\w+) \)" /gx) { $matrix->{$2}->{$3} = $1; } for my $x (keys %$matrix) { for my $y (keys %{$matrix->{$x}}) { print "$x / $y => $matrix->{$x}->{$y}\n"; } } __DATA__ "S (00exp)", "2/16/105", "19:59:6", "131.111.249.177", "18 (04Age)", "M (05sex)", "british (07Cn)", " (17Com)", "8 (SvAA)", "9 (SvAE)", "10 (SvAH)", "10 (SvAO)", "9 (SvAW)", "10 (SvAY)", "5 (SvB)", "3 (SvCH +)", "4 (SvD)", "2 (SvDH)", "9 (SvEH)", "9 (SvER)", "8 (SvEY)", "2 (SvF)", "8 (SvG)", " (SvHH)", "2 (SvIH)", "9 (SvIY)", "3 (SvJH)", "5 (SvK)", "8 (SvL)", "7 (SvM)", "8 (SvN)", "9 (SvNG)", "10 (SvOW)", "9 (SvOY)", "4 (SvP)", "8 (SvR)", "2 (SvSH)", "8 (SvT)", "2 (SvTH)", "10 (SvUH)", "9 (SvUW)", "6 (SvV)", "7 (SvW)", "9 (SvY)", "4 (SvZ)", "6 (SvZH)", "complete"

In reply to Re: Any help for this problem. Parsing/constructing results by saintmike
in thread Any help for this problem. Parsing/constructing results by steamerboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.