Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Line Number Confusion

by 2teez (Vicar)
on Oct 01, 2015 at 20:51 UTC ( [id://1143609]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Line Number Confusion
in thread Line Number Confusion

Hi,
I think you have the whole stuff mixed up. Please re-read all that has been posted on this thread already.
Then I think you also need to read up the documentation on $.
Simply, do perldoc -v $. from your CLI and you should have it.

Here is an example, if you may:

use warnings; use strict; my $look_for; while(<DATA>){ if (/^\./) { $look_for = $.; next; } print $., $_; } print "The dot came up on line ", $look_for, $/; __DATA__ Mary has a little lamb little lamb, little lamb . Mary has ....
Output
1Mary has a little lamb 2little lamb, little lamb 4Mary has .... The dot came up on line 3
Hope that helps!

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Replies are listed 'Best First'.
Re^4: Line Number Confusion
by hmeharward (Novice) on Oct 01, 2015 at 20:57 UTC

    Thank you so much! That does help. I'll keep reading!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-29 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found