elevenfly has asked for the wisdom of the Perl Monks concerning the following question:
Hello! I found a code like this:
perl -n -e 'print $_ if 1..2' test.txtThis code will only print the first and second in test.txt and I was told that if will compare $. with the line number I provide. But what is the reason for that?
Can anyone provide any help?
Thanks!,
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How does $. work in one liner?
by AnomalousMonk (Archbishop) on May 28, 2016 at 22:41 UTC | |
by Eily (Monsignor) on May 28, 2016 at 23:42 UTC | |
by Discipulus (Canon) on May 29, 2016 at 20:07 UTC | |
by Anonymous Monk on May 29, 2016 at 01:05 UTC | |
Re: How does $. work in one liner?
by Eily (Monsignor) on May 28, 2016 at 23:30 UTC | |
Re: How does $. work in one liner?
by eyepopslikeamosquito (Archbishop) on May 29, 2016 at 04:08 UTC | |
by afoken (Chancellor) on May 29, 2016 at 08:51 UTC | |
Re: How does $. work in one liner?
by stevieb (Canon) on May 28, 2016 at 22:32 UTC |
Back to
Seekers of Perl Wisdom