# This is my format
format FORMATTED =
@<<<<<<<<<
$date
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $subject
@*
$article
.
# This is where the text is pulled from a file and written into another using the format.
open(FORMATTED, "> $newspage") || sendError("can't write to $newspage");
open(DATAFILE, $articalsdat) || sendError("cant open articles file");
while ()
{
chomp; # remove newline
($date,$subject,$article) = (split(/-!news-/));
$date = "00/00/0000" if !defined($date);
$subject = "no subject" if !defined($subject);
$article = "no article" if !defined($article);
write(FORMATTED);
}
close (DATAFILE);