# Input: %btree is already tied to a $DB_BTREE file # $first and $last define the range to search for # It's assumed that the btree uses the default sort order my $db = tied %btree; my $key = $first; my $value; for (my $status = $db->seq($key, $value, R_CURSOR); $status == 0 && $key le $last; $status = $db->seq($key, $value, R_NEXT)) { print "$key = $value\n"; }