I'm not up on the specifics of how DBI handles field names, but let's assume each one is stored in the first element of the referenced array. You could get them all out with a
map.
@fieldNames = $sth->{NAME_uc};
printf "%15s %12s %12s %22s %9s %5s $5s",
map { $_->[0] } @fieldNames;
Update: I misunderstood the question -- I thought you had an array-of-arrays but it looks like just a simple array ref. Do what Tanktalus said. :)