my $i = 0; # Connect to Oracle database. #When you fetch the data for the below sql statment it is loaded into array index '0'. There is no way to index it. array = ['0','1','2',...'nth']. # Set up Query for ID my $stmt_1 = "select alignment from rd_list"; # Prepare Query my $query = $connection->prepare($stmt_1); # Execute Query $query->execute() or die $connection->errstr; # Create Array_ref for array. my $rows = $query->fetchall_arrayref; # Load data in array. foreach $i(0..$#{$rows}) { foreach $j (0..$#{$rows->[$i]} ) { $rows->[$i][$j]; } } my $num = $query->rows; print "\nThis process returns $num of ID's.\n\n"; while ($i<=2) { my $rd = "$rows->[$i][0]"; print "$rd\n"; $i++; }