This is a large and comprehensive site which seems to be mainly for the hard-core perl programmers so I hope you don't mind a quick question from a beginner?
My problem is an @ symbol which appears at the end of my lines of text. The lines of text are read from a file and shoved through a 'format', where they are written back into another file. The lines of text which generate the mysterious '@' are feed into the 'format' where they are supposed to be written in a multi-line, as-much-as-you-can-give style, which is done by the @* line of code.
Well, I hope I haven't confused you all too much. Here is some of my code. I hope you can pick up the problem from it:
# This is my format
format FORMATTED =
<font face="Arial"> @<<<<<<<<< </font>
$date
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $subject
@*
$article
</font><hr size="1" noshade></p>
.
# This is where the text is pulled from a file and written into anothe
+r using the format.
open(FORMATTED, "> $newspage") || sendError("can't write to $newspage"
+);
open(DATAFILE, $articalsdat) || sendError("cant open articles file");
while (<DATAFILE>)
{
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);
When the new file ($articalsdat) is viewed, there is an @ symbol after every line of $article? why? Will the kind monks help?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.