On Mon, Dec 23, 2013 at 09:30:22AM +0000, 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";
Your code could be summarized as: my ($x, $y) = foo() || die "..."; Note that the "||" operator forces the foo() call to be evaluated in scalar context, so only a single value is returned. It's evaluated something like this: my ($x, $y) = ( foo() || die "..." ); If you used the "or" operator instead you'd get the expected results because the or operator precidence is below that of the "=" operator so it's evaluated like this: (my ($x, $y) = foo() ) or die "..."; Tim.