in reply to Re: How to chomp the last new line character from the file
in thread How to chomp the last new line character from the file
If you take the truncate doc (which doesn't mention my boldfaced qualifier above) as a complete and accurate statement, you'll miss something: the file in FILEHANDLE or EXPR must be writable. truncate will fail or appear to fail without explanation if the file is, for example, flocked by another process, such as an editor -- or if FILEHANDLE or EXPR is opened for reading only (eg, open ($fh, '<', "EXPR") ....
BrowserUk deserves credit here for observing that Perl's truncate may well be merely "a flimsy wrapper around the POSIX call of the same name" and for referring me to http://linux.die.net/man/2/truncate, q.v., for
|
|---|