Reading up on seek, which I hadn't used before, what you seem to be doing is correctly opening your file, and then searching in the file for the point where you wish to begin.
is actually telling perl to offset the file by 1 byte and since it's a newly created file it simply creates the offset before it does anything else, hence the initial white space.seek(DATA, 1, 0);
Normally you would use seek for fixed length records where you can be sure that the beginning of a particular record can be found at an exact number of bytes into the file, so you were either told this for a specific purpose which you took to be standard procedure, or you were just told wrong! :)
As I mentioned this is from my reading and interpretation and I rather imagine I will be corrected by other more experienced monks so please read for yourself and draw your own conclusions rather than rely on mine!
I hope this has been helpful to you...In reply to Re: Re: File Truncation Question
by jonnyfolk
in thread File Truncation Question
by arrow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |