#!/usr/bin/perl

print "Enter the order cookie type:";
chop($type=<STDIN>);
print "Enter the order cookie amount:";
chop($amount=<STDIN>);
# check if inventory has enough
dbmopen %cookieJug, "cookieData", 0666;
$inventory = $cookieJug{$type};
if ($inventory < $amount) {
   print "No in stock! We will order for you. Take about a week.\n";
} else {
   print "In stock! Ship within 24 hours.\n";
   $cookieJug{$type} -= $amount;
}
dbmclose %cookieJug;    
