Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: converting table into an array of arrays

by jZed (Prior)
on Oct 18, 2007 at 17:28 UTC ( [id://645781]=note: print w/replies, xml ) Need Help??


in reply to converting table into an array of arrays

Presuming those are tabs between the columns, this should work:
use DBI; my $dbh = DBI->connect( "dbi:CSV:csv_sep_char=\t" ); my $arrayOfArrays = $dbh->selectall_arrayref(q{ SELECT * FROM "filename containing your data" });

Replies are listed 'Best First'.
Re^2: converting table into an array of arrays
by ikegami (Patriarch) on Oct 18, 2007 at 17:32 UTC
    Won't that create arrays of rows instead of placing each column in a separate array?
      Oh, duh, right. To get columns in an arrayref use $dbh->selectcol_arrayref().

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-18 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found