There's more than one way to do things | |
PerlMonks |
Re: How does $. work in one liner?by eyepopslikeamosquito (Archbishop) |
on May 29, 2016 at 04:08 UTC ( [id://1164428]=note: print w/replies, xml ) | Need Help?? |
In your example, you don't need the $_. This will print lines 1 and 2 from the file test.txt: If you prefer to be more explicit:
This type of question comes up often enough that I keep a list of one-liner references. Update: See also:
In Section
Seekers of Perl Wisdom
|
|