From: "Frank 'Olorin' Rizzi" <[EMAIL PROTECTED]>

> So, I love DBM files,
> because I think they'll work just great for the application I have to
> develop.
> 
> So far I worked with simple hashes (key => value) on DBM files, and
> everything seems fine. However, I now realize I need to complicate
> matters a bit.
> 
> Instead of a simple hash, I'll need something with a key, and two
> scalars associated to it. In more classical terms (I know, many of you
> won't like this..) the key is going to be a string, and each key
> should lead to a string AND an integer.

If you want to store something like this in a DBM you either have to 
use MLDBM or "serialize/stringify" the data yourself. Like for 
example join it using a character that may not be present in the 
data as a separator.

If you always need to store an integer and some string you might 
do it like this:

        # To store
        $data{$key} = "$the_int$;$the_string";

        # To read
        ( $the_int, $the_string) = split $;, $data{$key}, 2;

The MLDBM module actualy does something similar for you behind 
the scenes.

Jenda

=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
                                        --- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to