my $months = $dbh->selectall_arrayref("select to_char(last_day(add_months('14-May-2004', (rownum-1))),'MON-RRRR') dt from all_objects where rownum <= months_between(sysdate,'31-May-2004')+1"); my $month; my %monthhash; my $x = 0; foreach $month (@$months) { $monthhash{@$month[0]} = 0; print "check $monthhash{@$month[0]} @$month[0] @{$months->[$x]} ** $monthhash{ (@{$months->[$x]}) }\n"; $x++; }