Maybe I am missing something, but the only key you seem to use with the hash %dbase is "word". The string "word", not the contents of the $word variable. If all you want to do is to store the last processed word, it's not necessary to use a tied hash. Anyway if you do want to keep it and make sure the word does get stored in the file you have to flush it.

my $dbase_obj = tie (%dbase, 'DB_File', $dbase, O_CREAT|O_RDWR, 0644) || die "Died tying database\nReason: $!\n"; ... $dbase{word} = $word; $dbase_obj->sync()

Also please do NOT enclose variables in doublequotes, unless you do need to stringify a reference or something like that. "$variable" is almost always better written as $variable. If you are lucky, the doublequotes will just slow the script down, if not they will break it!

And there is another problem, the

shift @words until $words[0] =~ m/$start/;
looks for the first word that CONTAINS the last processed word. I don't think that's what you meant. I think you wanted this:
shift @words until $words[0] eq $start;

BTW, it's a shame some people don't agree with your sig. Well, to hell with some people! It's a shame my Squirrel thinks age does have some importance :-(

Jenda
XML sucks. Badly. SOAP on the other hand is the most powerfull vacuum pump ever invented.


In reply to Re: database not storing data by Jenda
in thread database not storing data by sulfericacid

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.