Re^3: How does $. work in one liner? -- it does not reset automaticallyby Discipulus (Abbot)
|on May 29, 2016 at 20:07 UTC||Need Help??|
In fact Eily is precise as always elevenfly, and he pointed exactly where $. is special in oneliners.
He gave you the definition, i'll add an example. Given a.txt and b.txt as following:
if you use $. to check line number (and $. is implicit for a bare .. flip-flop operator), you have:
and so is because $. does not reset automatically for an implicit close of the filehandle (and -n iterates across file given as arguments and reopen each time ARGV so without explicitly closing it).
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.