adler@coil.caltech.edu (Bo Adler) (07/26/90)
Has anybody else noticed that getting the keys of a dbm array
also returns one value which is a concatenation of all the keys and their
values?
Is there some particular reason for this action?
The program I used to discover this follows below... (apologies for
the coding style. I'm still learning...:-)
-B. Thomas Adler
adler@csvax.caltech.edu
-------------------------------------
#!/home/adler/bin/perl
$file = '/home/adler/src/indexer/test/indx';
print "Index what file? ";
chop($indxfl = <STDIN>);
dbmopen(Index, "$file", 0666);
open(FOO, "$indxfl");
while (!eof(FOO))
{
chop($line = <FOO>);
$line =~ tr/,.<>=_+|!@#$%^&*()/ /;
$line =~ tr/\/\\\-/ /;
$line =~ tr/~`;':"{}\[\]/ /;
$line =~ tr/A-Z/a-z/;
@words = split(/ */, $line);
while (defined($word = pop(@words)))
{
if (!defined($Index{"$word"}))
{ $Index{"$word"} = 0; }
$Index{"$word"} += 1;
}
}
close(FOO);
@words = keys %Index;
@words = sort(@words);
while (defined($word = pop(@words)))
{ print "$word\n";
}
dbmclose(Index);
exit;