Having had bad experience with Text::CSV_XS (I'm guessing it was probably me, not the module ;o) I tend to use hand-rolled solutions if it's nice'n'simple (I mean *really* simple), otherwise it's best to rely on the tried-and-tested APIs available. So anyway here's my meagre effort -
use strict; $_ = <DATA>; my $cnt = tr/,/,/ + 1; my @fields; push @fields, split /,/ while <DATA>; chomp(@fields); my %data; push @{$data{$_ % $cnt}}, $fields[$_] for 0..@fields-1; my @row; for (keys %data) { @row = sort @{$data{$_}}; print "$_ - @row\n"; } __END__ num1,num2,num3 123,345,578 345,349,340 12,348,023 534,90283,230 239,394,283
What this does is

Sorry if this is a little direct in approach, but if you're rolling your own it might nudge you in the right direction (and I was looking for a challenge, simple though it is :o)
HTH

broquaint

Update: it's probably best to go with davorg's approach if you actually want to implement this, but I'll leave this here in the spirit of TMTOWTDI.


In reply to Re: Comma Delimited File by broquaint
in thread Comma Delimited File by curtisb

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.