have you tried using Tie::File
it works great for me when reading and writing to files. Here is what I came up with:
tie @log, 'Tie::File', "C:/WINDOWS/U.S. Robotics 56K Voice INT PnP.log
tie @archive, 'Tie::File', "H:/ppp_stats.log";
push @archive, @log;
$#log = 0;
pop @log; #otherwise the first line of the file
#gets left there,
I did acouple of test runs on small files and it worked for me, but you might want to run some test before using it as working code. Feel free to make any edits. I make no promise that this will work for you, but it worked when I ran it.
I didn't put the use diagnostic in my code, I'm not sure what that does, I've never seen it before.
pointed out to me instead of finding the length of @log and subtracting that from $#log, I can just set $#log to 0, much easier :)
now it won't leave the blank line in the log file, not sure if thats the best way to do it, but it works
learning Perl one statement at a time.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||