I agree with you. I expected selectrow_array() to return an array whose values should equal the number of columns in the query, but it does not behave that way in my tests.
On 23 December 2013 22:35, Chad Wallace <cwall...@lodgingcompany.com> wrote: > On Mon, 23 Dec 2013 22:28:55 +0000 > Mimi Cafe <mimic...@gmail.com> wrote: > > > This helped. > > > > > On 23 Dec 2013, at 15:28, Bruce Johnson > > > <john...@pharmacy.arizona.edu> wrote: > > > > > > > > >> On Dec 23, 2013, at 2:30 AM, mimic...@gmail.com wrote: > > >> > > >> The SQL query is the same in both cases, and as can be seen, the > > >> query is expected to return two columns (user and perm), but > > >> selectrow_array() returns undef for the second column (perm in > > >> this case). > > >> > > >> my ($x, $y) = $dbh->selectrow_array(qq{SELECT user,perm FROM > > >> access WHERE token=\'Tt9VpStL4xADSDJQtd4AkM > > >> c6cVi66Mwmr9pMcCRgO4NVJ\'})|| die > > >> "Could not query database: $DBI::errstr\n"; > > >> > > >> In the above, $y is undef (or blank) although MySQL has values for > > >> both (user and perm) columns. > > > > > > The problem, which Martin correctly noted, is that selectrow_array > > > returns a single thing, an array containing the returned data. > > > > > > my ($x, $y) = $dbh->selectrow_array(SQL); > > > > > > is giving you a pointer to the returned array, $x, and an undef $y. > > Hold on... Am I missing something? > > What you seem to be saying, Bruce, is that selectrow_array() is exactly > the same as selectrow_arrayref(). I am certain that's not the case. > I've used both methods many times, and they are different. > > Is "a pointer to the returned array" not the same as "an array > reference"? > > > > > -- > > C. Chad Wallace, B.Sc. > The Lodging Company > http://www.lodgingcompany.com/ > OpenPGP Public Key ID: 0x262208A0 > >