Next Lightweight Databases 97

Multiple Values

     my $my_btree = DB_File::BTREEINFO->new();
     $my_btree->{flags} = R_DUP;
     $my_btree->{compare} = sub { lc $_[0] cmp lc $_[1] };
     tie %hash, 'DB_File', $file, O_CREAT|O_RDWR, 0666, $my_btree;
     for (['Red', 'apple'], ['red', 'cherry'], 
          ['RED', 'strawberry'], ['blUe', 'grape']) {
        my ($key, $value) = @$_;
        $hash{$key} = $value;
     }
     print join(" ", keys %hash), "\n";
     blUe Red Red Red


Next Copyright © 2003 M. J. Dominus