Perl: the Markov chain saw | |
PerlMonks |
looking for inspiration on 'compare'by zioigor (Initiate) |
on Mar 03, 2005 at 07:56 UTC ( [id://436114]=perlquestion: print w/replies, xml ) | Need Help?? |
zioigor has asked for the wisdom of the Perl Monks concerning the following question:
Bowing to higher level of knowledge,
I am working with solid-rock DB_File module, but something cracked my faith: i tried to ovverride $DB_BTREE->{'compare'}
routine with a String::Approx 'adist' one.
Belief and RTFM suggested to create a 'callback' with an easy template, something like ...
"hey man these are 2 parameters, do some kind of comparison and give me back -1, 0 or 1" as the 'cmp' example on documentation..."
so, after checking out the only working example routine with case-insensitive comparison on manual, i tried mine:
- .db file gets created and i checked the binaries - all data seem to fit BUT when i try to read out key/value pairs, i got "undef" on values for which comparison function returned -1. Any clue on how to make a Compare function different from the one on manual? many prayers are rising towards the Monastery thanks igor
Back to
Seekers of Perl Wisdom
|
|