Abigail-II's solution fails for the last string because of the empty entry E. Here's another way to parse this:

my @accounts = ( "A x1 B y1 C z1 D v1 E w1 F", "A x2 B y2 C zzz2 D v2 E w2 F", "A x3 B y3 C z3 D v3 E w3 F", "A x4 B y4 C z4 D v4 E wwww4 F", "A x5 B y5 C z5 D v5 E w5 F", "A x6 B y6 C z6 D v6 E F", ); # Transform @accounts in place for (@accounts) { tr/ //d; # get rid of those confusing spaces my @acct = split /([A-F])/; # use the tags shift @acct; # get rid of the undef pre-A entry... pop @acct; # ... and the 'F' my %stuff = (@acct); # hash what's left $_ = [@stuff{'A'..'E'}]; # keep ordered values } { local $" = "\t"; print "|@$_|", $/ for @accounts; } __END__ |x1 y1 z1 v1 w1| |x2 y2 zzz2 v2 w2| |x3 y3 z3 v3 w3| |x4 y4 z4 v4 wwww4| |x5 y5 z5 v5 w5| |x6 y6 z6 v6 |
The transformation of @accounts could be shortened a lot, but I wanted to show it step-by-step for clarity. Your data format is not of the handiest.

After Compline,
Zaxo


In reply to Re: Array in Array by Zaxo
in thread Array in Array by nylon

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.