| Next | Lightweight Databases | 98 |
$my_btree->{compare} = sub { lc $_[0] cmp lc $_[1] };
%hash = (Red => 'apple', red => 'cherry', RED => 'strawberry',
blUe => 'grape');
Since the keys are insensitive, the hash interface can't distinguish them:
print "$hash{blUe} $hash{red} $hash{Red} $hash{RED}\n";
grape apple apple apple
But ->seq can recover the values:
my $db = tied %hash;
$k = $START = 'red';
for ($fail = $db->seq($k, $v, R_CURSOR);
! $fail;
$fail = $db->seq($k, $v, R_NEXT)) {
print "$k: $v\n";
}
Red: apple
Red: cherry
Red: strawberry
| Next | ![]() |
Copyright © 2003 M. J. Dominus |