http://qs321.pair.com?node_id=1168772


in reply to How to parse a file with emails and IP's and output a sorted list with a total count

I'm not sure why you are trying XML::Simple as there doesn't seem to be any XML involved. For data storage, you seem to need a hash of hashes. I'll assume you can get the IP and email address from the file.
my %users; foreach my $line (<$file>) { my ($email, $ip) = parse_line($line); $users{$email}{$ip}++; }
Then you'll have a hash that looks something like:
%users = ( 'joe@example.com' => { '192.168.10.24' => 2, '192.168.10.28' => 1 } );
  • Comment on Re: How to parse a file with emails and IP's and output a sorted list with a total count
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: How to parse a file with emails and IP's and output a sorted list with a total count
by mitzyc (Initiate) on Jul 28, 2016 at 23:21 UTC

    Yes! I can get the IP and the email.

    That little bit is enough to get me started. I really didn't know how to load and reference a hash with values.

    ...and no, I guess I didn't need XML at all.

    Thank you very much. This will give me a greater appreciation of how this works and a solid footing to start from.

    Thank you so much.