in reply to Re: Append to beginning of line (multi line file)
in thread Append to beginning of line (multi line file)

(undef)=<FILE>; reads lines out of <FILE>, and stores it nowhere, it's the same as <FILE>. The answer to your puzzle isn't that (undef)=<FILE> is somehow magical (other then having a list-context call that goes nowhere; ()=<FILE> would should work just as well for that), it's that $. is a special variable that holds the current (input) line number. It's updated on all reads.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).