On Nov 30, 5:07 pm, [EMAIL PROTECTED] (Beginner) wrote: > Can someone spot and explain what I am doing wrong.
Yes. > I have a script that should read the contents of a CD (on Win32). I > want a summary at the top of the page of what I've found. I use find > to count the files and dirs and I want the total files ($in) to be a > the top before I list the files. Once I have printed the header stuff > ("Content of ..."), I store the position of the filehandle so I can > come back to that position later... > The text starts in the expected place but although I have created 12 > newlines for the summary text (that should only use 9 lines) the text > crashes into listing sucking up any spare newlines as it goes. > Am I making sense? No. > Any ideas? Files (on most commonly used OSs) consist of bytes, not lines. It you seek back to the start of a file and write one line of text it does not replace the first line in the file. It replaces the bytes at that position in the file. This could be more or less than the first line. If your file is using a format where EOL is represented by two characters and/or where characters are represented by a variable number of bytes you may not even end up with a valid text file at all. Depending on what's reading your file you may be able to get away with padding with a lot of NULs. This, of course, has nothing whatever to do with Perl. See also FAQ: "How do I change one line in a file/delete a line in a file/insert a line in the middle of a file/append to the beginning of a file?" -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/