develooper Front page | perl.beginners | Postings from March 2002

Passing question on DMB files with complex stuff

Thread Next
From:
Frank 'Olorin' Rizzi
Date:
March 4, 2002 20:54
Subject:
Passing question on DMB files with complex stuff
Message ID:
20020305045456.94284.qmail@onion.perl.org
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.

Things I have to do with this structure:

assume I have data in a text file ("myfile_1.in") with data in the format
this_is_a_key    this_is_a_value    n
(they are tab-separated)

1- get the data from myfile_1.in and create/update a DBM file pair

assume I have a nother file "myfile_2.in" with data in the format
maybe_a_key
(one per line)

2- check if each string in the myfile_2.in file corresponds to a 'record' in
the DBM file pair
(depending on the result fo the check I'll do different stuff)

This is not very complicated. I have it down for a simple hash, but I'd like
to hear suggestions on how
to do this for this slightly more complex set up. It's a matter of
experience. Having about zero XP with Perl,
I'd rather listen before jumping into it...

thank you in advance,
F.O.R.






Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About