In addition to the good things
Corion mentioned about always checking for errors when you make system calls and explicitly specifying "<" when opening files (even when you don't have to), I noticed a couple of other things.
Because $line is a scalar variable, you are reading the file in line by line. Thus the first line is read in at the first instance of
$line=<FILE>
then the second line, and subsequent lines, are read in during the
while() loop. With your code, the first line won't be printed. That may or may not be what you wanted.
Finally, you'll probably need a carriage return and/or a line feed, so your print line should probably read something like
print "$line\n\r";
Again, this may or may not be what you want, but my experience with NT tells me the addition of a CR and/or LF often makes a difference.
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.