Hi Monks!
I'm investigating a file, matching and extracting interesting stuff. I split the file several times so it's not intact during my operations. Now I want to know the line number where I extracted something. Is it possible to get this without having to use some kind of counter?
An example to illuminate my problem further:
if(/(\S+)\s+(\d+)/)
{
$mylist{$1} = $2;
}
This is one of the regexes I use to store values in a list. Is it at this point possible to get the line number where I got the match? I have the filename as a variable, but when I match $_ isn't the entire file, but a small part of it.
Thanks!
Update: I read the file with
while (<MYFILE>)
{
$alldata .= $_ ;
}
Newlines aren't important when going through the data.