Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Re: Re: Short (and clever?) CSV-to-AoA

by merlyn (Sage)
on Apr 24, 2001 at 00:26 UTC ( #74862=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Short (and clever?) CSV-to-AoA
in thread Short (and clever?) CSV-to-AoA

Ahh, then it's just a matter of asking for the right print! The idiom for "extract a column while printing" is known, and reusable:
my @AoA = map [split], <DATA>; print join(", ", map $AoA[0][$_], 0..$#{$AoA[0]}), "\n";

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: Re: Re: Short (and clever?) CSV-to-AoA
by scott (Chaplain) on Apr 24, 2001 at 00:51 UTC

    Cool. But I don't want to extract a column while printing, the print was just a way of showing the results if someone wanted to run the code.

    I want to have an AoA with each element being a column of data ...not that I ever said as much, which, in retrospect, would have avoided lots of time spent by other people trying to figure out what my real goal was.


    And thanks for the 'idiom', I added it to my personal archive of neat little bits O'Perl.

        :) OK, that's obviously a much more standard way to do it than mine... and 20% faster on the one platform I can test it on.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://74862]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2020-10-28 03:41 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (259 votes). Check out past polls.