I was too dizzy after looking at your code (could've been the tequila) , so I offer a simpler strategy which I employed on more than 1 occasion:
#!/usr/bin/perl -wT use strict; use CGI; my %defaultRecord = ( interaction_site => undef, TITLE => undef, channel => undef, target_cell =>undef, c_end => undef, ,); my $blankRecord = new CGI(\%defaultRecord); $blankRecord->param(-name => 'channel', -value => 'Sodium channel', ,); open(SAVERECORDHERE,'>','savedrecord.dat') or die "crapola $!"; $blankRecord->save(SAVERECORDHERE); close(SAVERECORDHERE);
I will now add a quote from the CGI pod (my fav, quoting pod that is):

SAVING THE STATE OF THE SCRIPT TO A FILE:     $query->save(FILEHANDLE) This will write the current state of the form to the provided filehandle. You can read it back in by providing a filehandle to the new() method. Note that the filehandle can be a file, a pipe, or whatever!

The format of the saved file is:

NAME1=VALUE1 NAME1=VALUE1' NAME2=VALUE2 NAME3=VALUE3 =
Both name and value are URL escaped. Multi-valued CGI parameters are represented as repeated names. A session record is delimited by a single = symbol. You can write out multiple records and read them back in with several calls to new. You can do this across several sessions by opening the file in append mode, allowing you to create primitive guest books, or to keep a history of users' queries. Here's a short example of creating multiple session records:
use CGI; open (OUT,">>test.out") || die; $records = 5; foreach (0..$records) { my $q = new CGI; $q->param(-name=>'counter',-value=>$_); $q->save(OUT); } close OUT; # reopen for reading open (IN,"test.out") || die; while (!eof(IN)) { my $q = new CGI(IN); print $q->param('counter'),"\n"; }
Not only does the above make life simpler, it's built on the tried'and'true CGI.pm.

Now you can concentrate on finishing your app, instead of parsing flat-files ... also, an alternative to the above CGI thingy might be to use windows ini style records, something like

[recordorsomething] key = value k0ey = valuee [recordothersomething] k = v
for which there is also a module on cpan (Config::INI)

What I also like to do, as opposed to using a flat-file, is to add DB_File to the mix, which along with CGI.pm, makes for better than flatfile, and as always,makes for an easy to parse, quick to write with the security of familiarity, solution.

Happy Coding!

update:
It has been brought to my attention, that gdnew is using a very peculiar dataformat, sorta like:

COMMERCIAL SUPPLIERS SEQUENCE /exon="1-120" /intron=" " //
mentioned in strange quotes.

Now my question is for you gdnew, where did you get the idea to use such a bizzare format?

 
______crazyinsomniac_____________________________
Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"


In reply to (crazyinsomniac) Re: about where to check the flag by crazyinsomniac
in thread about where to check the flag by gdnew

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.