Assuming you are saying you need to read/write to a dbm I would suggest looking at DBM and DB::File (cpan)

Otherwise if it is a Flat file of text please give us an example of the data you need to parse

heres simple module I wrote for a project to ease reading/writeing to a DB::File. It uses storable so you can store structures in the dbfile easily.
package easydb; use strict; use DB_File; use Storable qw(freeze thaw) ; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(&db_open &db_close &db_store &db_fetch &db_keys); @EXPORT_OK = qw(&db_open &db_close &db_store &db_fetch &db_keys); my %db ; sub db_open { my $dbfile = shift ; tie(%db, "DB_File", $dbfile) or die "Can't open $dbfile: $!"; return \%db ; } sub db_close { untie %db ; } sub db_store { my ($key, $hashref) = @_ ; $db{$key} = freeze($hashref); return $key; } sub db_fetch { my ($key) = shift; my $ref = thaw($db{$key}) ; return $ref ; } sub db_keys { return keys %db ; } 1;
and heres an example of how it is used in a program:
#!/usr/bin/perl use lib('.'); use warnings; use easydb ; use Data::Dumper; use strict ; my $dbfile = "some.db" ; db_open($dbfile) ; my %legend = ( "asap.cgi" => "Journal ASAPS", "abstract" => "Journal Abstract", "query" => "Journal Query", "cen" => "CEN Report", "preprint" => "Preprint Report", "reagent2000" => "Reagent Report", "article.cgi" => "Current Journal Articles", "archive.cgi" => "Article Archive" ) ; db_store ("legend",\%legend); my $legend = db_fetch("legend"); foreach my $key (sort keys %$legend ) { print "$$legend{$key}\n"; } db_close() ; exit ;
Not a lot of comments, but it may help ya out there


In reply to Re: Perl and delimiator by yodabjorn
in thread Perl and delimiator by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.