in reply to How can I grep these IP-addresses from these logfiles?

Thank you for the example, it's good!

You have only to copy this line ...

my $IPs="(1.1.1.1|192.168.1.1|10.10.10.10)"; #notice the '|' as a different option to compare

And replace I WANT TO GREP FROM IP.TXT for $IPs.

And the last $file should be $filename.

Please, try it!

Listen, if you are learning all this, but you don't understand it, you are loosing your precious time.

You should undertand all these so well that you might write it in a different manner a lot of times... (if you want to do of this learning something useful, not because of anybody)

If you need to read the IPs from a file, just imagine that it is another text file, and read it the same as any log file. Then keep the IP values.

Use this practice to create a game, or something that you need and don't want to spend a lot of time writing. Something funny, or original.