Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Line number in a file

by murugu (Curate)
on Jul 06, 2004 at 10:28 UTC ( [id://372058]=note: print w/replies, xml ) Need Help??


in reply to Line number in a file

if $/(input record separator) is '\n',

use $. which is used to get the current line number.

for ur problem, use $` and count the number of \n which yields the line number.(But using $` makes program run slow)

cheers

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://372058]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-18 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found