in reply to how do i store the result from query into hash

Well, if you are using DBI, this is rather simple:
my $sth = $dbh->prepare("SELECT item, quantity FROM inventor") or die +DBI->errstr; $sth->execute() or die DBI->errstr; my %hash; while( my( $item, $quantity ) = $sth->fetchrow_array() ) { $hash{ $item } = $quantity; } # do whatever you'd like with hash.

Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain