I have this simple script that I’m working on. I must admit, I’m totally new to PERL and kinda stuck with this stupid problem.
open(IN, "<def/t.html") or die();
while(<IN>) {
chomp;
if($_ =~ m/FF0000/) {
print "\n".$_."\n";
}
}
So… I opened the t.html and found the given string in the file. Output was ok, but I need also filename of a file in which string was found, to be printed. I really don’t know how to return this, and I need it right after the $_. Thanks for the help in advance.
That is a strange idea, but you can if you want:
Here you know only the filedescriptor and find the filename using it.
You can also write it much shorter with
readlink:I must note that the file can be already deleted (but it exists still if it is open).