Next Lightweight Databases 96

Multiple Values

     my $dup_btree = DB_File::BTREEINFO->new();
     $dup_btree->{flags} = R_DUP;
     tie %hash, 'DB_File', $file, O_CREAT|O_RDWR, 0666, $dup_btree;
     while (<FRUITS>) {
        my ($color, $fruit) = split / /, $_, 2;
        $hash{$color} = $fruit;
     }
        $k = "red";
        for ($fail = $db->seq($k, $v, R_CURSOR);
             ! $fail && $k eq "red";
             $fail = $db->seq($k, $v, R_NEXT)) {
          print "$k: $v\n";
        }
        red: apple
        red: cherry
        red: strawberry
        red: raspberry


Next Copyright © 2003 M. J. Dominus