This is all about knowing the data. You have to understand the realms of the world you're working in.
1. The first value in a rule can only be Source or Destination.
2. The second value is the name of a value in the packet.
3. The third value is the value in the packet itself.
Correct?
Then knowing that, start constructing the same guidelines of the data for the ip packets themselves. Know where in the packet you can find whether it's a source or not. Know where the ip is stored and the domain is stored. Once you know all that, it's a simple matching.
As you've said, it's vague as to which part of the assignment you're actually having trouble with. If it's not the logic of it, and you're having trouble with coding something that goes through a file line by line, then see below
use warnings;
use strict;
open(FH, '<', "rules.txt");
my @data = <FH>;
close FH;
foreach my $value (@data)
{
chomp($value);
my ($SourceorDestination, $name, $value) = split(/,/, $value);
#Insert compare code here
}
I know that many monks would tell you not to load the contents of the file into an array like I have, but I imagine that your rules file won't be huge and you'll be needing it every time you compare a packet.