My first post in this site

For most of the cases you can use the variable $.

So the code would come:

Code:
while (<>) {
     print "$.\t$_";
}
tarunt like this