Hi
Please can someone guide me how to do this ?
1. I have a data file "path.csv" and it's contents is:
2. here basically i need to count the number of times each IP address shows up in the file based on the KEY
3. After loading above KEY:VALUES pair to HASH, i want to read IP and count based on each KEY and print into a file.
I have coded something like below,i had given only the function:
sub _Load_IP
{
if(! open (PATH_FILE_FH, "$Path_File"))
{
print "Failed to Open input PATH_REPORT File: $Path_File\n";
exit 1;
}
while(<PATH_FILE_FH>)
{
my $data =$_;
chomp($data);
my($pname,@val) = split(/\s+/,$data);
my($Starpnt,$Endpnt) = split(/_/,$pname);
$key = $Startpnt;
#$IP_hash{$key} .= exists $IP_hash{$key} ? map{$IPcountList{$_}++ }"
+@val" : @val;
$IP_hash{$key} .= "@val";
}
close(PATH_FILE_FH);
} #End of _Load_IP()