In message <[email protected]>,
Rafael Bonilla writes:
>Now I have the following problem.
>
>I need to count how many times certain traffic comes from an IP address. I'm
> using perl hashes for that where the IP address is the key and the counter
>is the value. Fine so far. Then, I need to report that and for that I'm doin
>g the following inside eval:
>while ( my ($key, $val) each %%my_hash) {
> print (IP: $key, counter: $val);
>}
Don't you need an = sign in there somewhere?
while ( my ($key, $val) = each %%my_hash) {
...
Otherwise I think each is in scalar context.
>The counter values print fine but all keys print some gibberish instead of
>the IP addresses.
I can't explain how your example works at all.
>Any suggestions?
Also you could use each in scalar context and use:
print ("IP: $key, counter: $$myhash{$key}");
or something along those lines.
--
-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users