http://www.perlmonks.org?node_id=136670

cdherold has asked for the wisdom of the Perl Monks concerning the following question:

Hey Monks,

I'm trying to get information from a database into an array in Perl. The database (MySQL) has company names each as a separate row. There are about 300. I would like to put these into an array called "@companies". Its been a long time since i've worked with Perl ...

$dsn = "DBI:mysql:yip;db.yip.com"; $dbh = DBI->connect($dsn,'me','pass'); $sth = $dbh->prepare("SELECT company FROM company_public;"); $sth->execute(@companies); $dbh->disconnect;
I thought that this (above) might put the values into the array for me, but no go on this first try. What do you think?

thanks Monks,

Penguin In The Dark