#!perl use strict; my %data=(); my @data1 = ( '8 14.701072 3.011583 2.943297 2.940214 2.955738 2.968009', '16 30.561410 6.249463 6.118992 6.124449 6.112282 6.133605', '32 60.983738 12.254996 12.263543 12.277047 12.291713 12.196748', '64 116.472912 24.024475 23.347609 23.463421 23.294582 23.336542'); my @data2 = ( '8 14.788687 3.083707 2.958022 2.957737 2.982671 2.990788', '16 30.368369 6.384345 6.079698 6.073674 6.108037 6.134851', '32 60.373260 12.492582 12.137764 12.164201 12.074652 12.107912', '64 117.676048 24.010324 23.535210 23.562157 23.596123 23.675554'); for (@data1,@data2){ my ($sz,$sum,@f) = split /\s+/; push @{$data{$sz}},$_ for @f; } for my $sz (sort {$a <=> $b} keys %data){ print join ' ',@{$data{$sz}},"\n"; }
poj

In reply to Re: Appending arrays into the rows of a 2 dimension array by poj
in thread Appending arrays into the rows of a 2 dimension array by SoftwareGoddess

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.