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()

In reply to count the number of IP shows up in the file by sgowrish

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.