Brothers,
I'm currently 'perling' a classic perl task. But I'm not quite sure, if the is a much better way. Maybe some of you have another idea to do this:
I got a big file with about 20 different 'lists' in it. Each list must be broken into peaces, exactly by a given template. I got the 'coordinates' of the different Tag-Regions.
i.e.:
List 100:
W01 625 Z01 WWGZU Q19 0.343
S02 W222G02 XXXX9 B11 Mr.
        G03 uu 1      Adams
This has to be converted into :
W01 625
Z01 WWGZU 
Q19 0.343
S02 W222
G02 XXXX9 
B11 Mr.|Adams
G03 uu 1
So my idea was to take one whole list, put it into an $hash->{col}->{row} hash, and took out all the defined tags by there coordinates. This works, but it's a bit slow. The hash-filling took a lot of time, I guess:
my $line = 0; while (<FILE>) { my @linesplit = split //, $_; my $i = 0; for my $column (@linesplit) { $list->{$line}->{$i}= $column; $i++ } $line++; }
But maybe there is a much better way for this kind of task, or even a cpan-module?
Thanks for any suggestions.
----------------------------------- --the good, the bad and the physi-- -----------------------------------


updated by boo_radleyTitle change

In reply to Break List into Pieces (was: other ways ?) by physi

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.