Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apending files AT THE TOP

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I just wrote my first CGI script (and Perl script, for that matter) which updates the news of the index of a site through a form.  Everything works fien except that it appends the file at the bottom and not at the top. So the new news that is entered through the form is placed at the bottom of the news rather than at the top.  I know there is a way to fix this. What is the syntax to append a file at the top and not at the bottom (the file is a news file, so all context of the past news is in similar format to the newly posted one).  I appreciate any help.
 
It would be helpful if you posted your code here so that we could take a look at it.<br><br>Thanks.<br><br>-Vic
 
my $new_item = &quot;your new news&quot;;<br><br>open (NEWS, $news_file);<br>my @NEWS = &lt;NEWS&gt;;<br>close (NEWS);<br><br>open (NEWS, &quot;&gt;$news_file&quot;);<br>print &quot;$new_item\n&quot;;<br>for (my $x=0; $x&lt;@NEWS; $x++)<br>{<br>&nbsp;&nbsp;print &quot;$NEWS[$x]\n&quot;;<br>}<br>close (NEWS); <p> Sincerely,<br><a href=mailto: > </a><br><a href= Anderson</a><br>CEO, Order amid Chaos, Inc.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top