[comp.lang.perl] problem reading assoc array

rahardj@ccu.umanitoba.ca (B. Rahardjo) (09/14/90)

After upgrade my perl into pl. 28 I have been having some
problems with reading associative array.
The following script doesn't produce the output that I want.
Help ....

-- budi 

----- cut here -----
#!/usr/local/bin/perl
#
$filename='testfile';
# Create a dbm file
dbmopen(RECORD,$filename,0666);
$RECORD{'one'}='One and only one';
$RECORD{'two'}='Number two';
dbmclose(RECORD);
# Read the dbm file back
dbmopen(recd,$filename,0666);
print 'The keys are   : ', keys %recd, "\n";
print 'The values are : ', values %recd, "\n";
foreach $i (keys %recd) {
	print "$i : $recd{$i}\n";   # THIS PART DOESN'T WORK
	}
dbmclose(recd);
-- 
Budi Rahardjo <rahardj@ccu.umanitoba.ca> <rahard@ee.umanitoba.ca>
Electrical Engineering - University of Manitoba - Canada