in reply to printing line number

Sounds like homework so I'll just give you a hint:
check out $. perldoc perlvar

Sweetblood