The script behaves strangely when the source file is removed and recreated.
like so, test.txt is created by doing echo "" > test.txt
run -> perl this.pl
other window (ow) echo one >> test.txt
one
(ow) echo two >> test.txt
two
(ow) del /F test.txt
(ow) echo uno > test.txt
(ow) echo due >> test.txt
(ow) echo tre >> test.txt
re
(ow) echo quattro >> test.txt
quattro
So it seems to hold on to the last cursor position and won't yield any output until that last postion is surpassed ?
Also when you first run it, it outputs the entire file, is it possible to set $lastpos to its current EOF line ? ie Can it go to the bottom and wait for the next newline ?
Also if I wanted to hand the output to a program, rather than print, how would I change
print while <inFile>; ??
Thanks !
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.