Perl newbie question

Can someone tell me what this is doing? I know it is reading records from a table and puts them in a hash. How do I print out, let's say, the first 5 columns of data (assuming columns are named col1, col2, ...)?

    $sth = $dbh->prepare("select *
                          from stsc.loc
                          where p_loclevel = 4 and rownum < 11");
    $sth->execute();
    while (my $hash_ref = $sth->fetchrow_hashref('NAME_lc'))
    {
        $dlrinfo{$hash_ref->{loc}} = \%$hash_ref;
        $dlrcount++;
    }

perldoc DBI
will tell you :wink:
But to be of little more help,
it's been quite a while since I last have written Perl code that used the DBI.
Thus it's likely I forgotten most of DBI.
But if I remember correctly,
the fetched hash'es keys are the field names of the table items
that you prepared in your select statement.
Since NAME_lc is passed you can safely reference the keys all lower case.
Hint, in Oracle's sqlplus you could issue a desc on the table you select
to see the field names.
Once the result set is fetched in your hashref it's very easy to refer to the fields
thanks to Perl's arrow operator.
Since I don't know you table's fields I use field_N here.
e.g.

my $field_1 = $hash_ref->{field_1};
my $field_5 = $hash_ref->{field_5};

But you could also reference them collectively by a hash slice.
e.g.

my ($field_2, $field_7, $field_3) = @{$hash_ref}{qw(field_2 field_7 field_3)};

But admittedly, this looks rather ugly,
and referencing like this gave Perl the reputation of line noise and obfuscation.

Thanks for the info