I have hava a small flat file database (an article script) and I want to have the entires in the db to be put in the first line instead of the bottom
currently this is the "code"
[code]
open (DATABASE,">>$data_server_path$articles_libris_database");
print DATABASE join "\¦", $itemid, $FORM{'name'}, $FORM{'author'}, $FORM{'content'}, $FORM{'image'}, $FORM{'contactemail'}, $FORM{'itemurl'}, $FORM{'group'}, $FORM{'date'}, $FORM{'empty_var_one'}, $FORM{'created_on'}, $FORM{'custom'}, $FORM{'empty_var_two'}, $FORM{'idle_2'}, $FORM{'image_caption'}, $FORM{'idle_4'},"\¦\n";
close(DATABASE);
[\code]
I have searched online and it seems the many pages and links I found none had the information I was looking for or the website was gone /dead
Any suggestions would be appreciated
Have a wonderful day
FlyingWulf
Learning as I stumble on my shoe strings
#
open (SNEW, "$News_Article_DB");
seek (SNEW,0,0);
@lines = reverse <SNEW>; # reverse for 'LIFO'
close (SNEW);
#
foreach $line (@lines) {
#
# do stuff like;
# only print 'x' number of lines
# or lines with certain data in them...
#
}
#
If the data file grow very large and gets hit often, you might want to archive off chunks of it every so often.
...first one to say "What's SNEW?" gets thwapped in the head with a SS-SD 5 1/4" floppy....<grin>