ALTERNATE INTERPRETATION OF OP's DESIRES; namely, that cristianro87 wants to summarize ALL the data elements:

#!/usr/bin/perl use warnings; use strict; use 5.016; # 1087978 while (<DATA>) { my ($chrom, $pos, $id, $ref, $alt, $qual); if ($_ =~ /#CHROM.+/ ) { # title "Load table with row/co +lumn names" next; # does NOT match "access the el +ements" example } elsif ( $_ eq '' ) { last; } else { ($chrom, $pos, $id, $ref, $alt, $qual) = split; # desired out: [chr1][1092482][REF] = T say "[$chrom] [$pos] [REF] = " . $alt; } } =head execution C:\>1087978.pl [chr1] [1092344] [REF] = T [chr1] [1092367] [REF] = T [chr1] [1092400] [REF] = C [chr1] [1092424] [REF] = G [chr1] [1092461] [REF] = A [chr1] [1092470] [REF] = G [chr1] [1092482] [REF] = C [chr1] [1093235] [REF] = A [chr1] [1093245] [REF] = T =cut __DATA__ #CHROM POS ID REF ALT QUAL chr1 1092344 . G T 79.54 chr1 1092367 . C T 148.50 chr1 1092400 . G C 90.54 chr1 1092424 . A G 93.14 chr1 1092461 . G A 105.30 chr1 1092470 . T G 103.06 chr1 1092482 . T C 104.33 chr1 1093235 . G A 16.08 chr1 1093245 . C T 244.75

Far simpler: no hashes but possibly (caveat here ->) a simple-minded interp of an unclear SOPW.


If I've misconstrued your question or the logic needed to answer it, I offer my apologies to all those electrons which were inconvenienced by the creation of this post.

In reply to Re: Load table with row/column names by ww
in thread Load table with row/column names by cristianro87

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.