In the quest of a better solution I would just offer to bang out a few dents to make thing look better.

Your code that assign field values to individule vars is very hard on the eyes and could be difficult to debug if you get one of those index wrong. This is compounded by the list being out of order (1 before 0) and the subroutine call hidden in the batch.

If you would keep this code tab it out so all the "=" and "$line_pair[]" are aligned. Either do the sub call right after the variable assignment and put some blank lines around it or just do after the whole transfer block.

On the other hand if you don't need to do the transfer at all, all the better. If all that you do is a straight display of the vars in the same order they are in the file then you don't need to transfer them.

If you need to manipulate a few of them them then create named indexes like (put near the top of your file)

# indexes to $line_pair $i_data = 5; #add more here if needed.
and then call the sub this way
$line_pair[$i_data] = &stripBadHtml($line_pair[$i_data]);
although this line is more complex there is only one of them, not 15. Also, without the transfer( it may still be needed if you are get the vars off an HTML form) the output line could go from:
print DATAFILEOUT "$time=$company_name=$email=$member1=$member +1phone=$data=$expiretime=$pictureurl=$password=$website=$member2=$mem +ber2phone=$address=$citystatezip=$fax=$catlisting\n"
to
print DATAFILEOUT join("=",@list_pair),"\n";
In general code should not be hard to look at or look like it was hard to type in. Someone will have to look back at the code again sometimes and it is good practice to make code clear for the next programmer to look at it.

Remeber that next programmer may be you. Disclaimer


In reply to Re: Re: Flat Database: Outdated Info Removal by admiraln
in thread Flat Database: Outdated Info Removal by lisaw

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.