#!/usr/bin/perl

dbmopen %cookieJugOne, "cookieData", 0444;

print "cookie      noOfboxes\n";
print "=" x 25 , "\n";

foreach $type (keys %cookieJugOne) {
  $paddedType = pad($type, 14);
  print "$paddedType $cookieJugOne{$type}\n";
}

dbmclose %cookieJugOne;    

sub pad {
   my ($type, $maxChars) = @_;
   print "parameter type=$type, maxChars=$maxChars\n";
   $length = length $type;
   print "no of characters in $type=$length\n";
   for ($i=0; $i<$maxChars-$length; $i++) {
      $type .= " ";  # if use += it will be error 
   }
   return $type;
}
