in reply to fetchrow_array returns an empty array

I am not sure that your SQL works without knowing the details of what XMLRECORD and F_COMPANY mean.

What does this code print?

use strict; use warnings; use Data::Dumper; #..... my $sth = $dbh->prepare("select XMLRECORD from F_COMPANY") or die "Couldnt prepare statement: " . $dbh->errstr; $sth->execute(); my $array_ref = $sth->fetchall_arrayref(); print Dumper $array_ref;
It could be that @$array_ref contains no elements. That is completely legal. If you do have a non-zero array, then Dumper should be able to print it out. then we can work on your code to dereference the bits that you want. Update: and work on making this more memory efficient (if necessary).