in reply to Why is $. not zero-based?
The simplest answer is "Because Larry Wall wanted Perl to be similar to /bin/awk, and $. is the Perl version of /bin/awk's NR variable. NR starts at 1."
As for why /bin/awk starts NR at 1? I would guess that this is because most line editors consider the first line in the file to be line 1, not line 0. Tradition is a powerful force, and in this case, most people do not find it unexpected that $. is 1 for the first line in the file.
|
|---|