in reply to Re^2: extract column data
in thread extract column data

Maybe now is a good time to review DBI to see what methods can be called on which objects and what the sequence of when to call which is.

If you are unable to modify your code to use ->fetchall_arrayref, consider reading the documentation for ->selectall_arrayref and using that method.

Replies are listed 'Best First'.
Re^4: extract column data
by bigup401 (Pilgrim) on May 24, 2017 at 13:43 UTC

    selectall_arrayref seems to work but am getting

    ARRAY<0x1c56ba4>
    my $sth = $dbh->selectall_arrayref("SELECT lastname FROM dbase");

      Hello bigup401,

      The output is correct. See bellow:

      #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $array = ["Test1", "Test2"]; print $array . "\n"; print Dumper $array; __DATA__ $ perl test.pl ARRAY(0x83b178) $VAR1 = [ 'Test1', 'Test2' ];

      You can read a bit more at perlref.

      Hope this helps.

      Seeking for Perl wisdom...on the process of learning...not there...yet!

        thanks, am now getting all lastnames printed but comes in array format with comma, single quots brackets and am not good in regex to remove [', and make it well printed like

        John Doe Smith

        any idea

        my $sth = $dbh->selectall_arrayref("SELECT lastname FROM dbase"); $dbh->disconnect; @data = Dumper $sth; print @data;
          A reply falls below the community's threshold of quality. You may see it by logging in.