Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Generating a List of numbers

by JavaFan (Canon)
on Jan 31, 2012 at 02:45 UTC ( #950859=note: print w/replies, xml ) Need Help??

in reply to Generating a List of numbers

I would do something like (untested):
use autodie; my %byte_count; open my $fh1, "<", "TmpLookingForIPFile"; while (<$fh1>) { chomp; $byte_count{$_} = 0; } open my $fh2, "<", "TmpIPFile"; while (<$fh2>) { next if /^sh|^\s*Source|^$DestDevice|^Accounting|^^M|^$/; # Do NO +T end with |/ here, as it then will always match chomp; my ($dest, $bytes) = (split)[1, 3]; $byte_count{$dest} += $bytes if exists $byte_count{$dest}; } while (my ($ip, $bytes) = each %byte_count) { my_sub($ip, $bytes); } sub my_sub { ... something that uses the ip and the byte count }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950859]
[marto]: icy here today, snow on the hills
[Corion]: Oh yes, Friday!
[Corion]: Last day at $work before 3 weeks of vacation (well, not that I'd be really travelling, but no-work-time ;) )
[robby_dobby]: marto: yeah, I'd eventually visit Glasgow some day - just to visit the home town of GHC :-)
[robby_dobby]: Corion: Oh, that's awesome! Your timing is perfect enough to see all hell break loose when you get back at work :P
[marto]: well, let me know in advance, I'll buy you a pint :)
[Corion]: robby_dobby: No, I'm returning in the second workweek of January. The main hectic parts are in the first days after the start of the new year
[robby_dobby]: marto: and, I'm not sure I'd be around here long enough for YAPC::EU
[marto]: Corion nice, what are you plans for Christmas?
[robby_dobby]: Corion: Nice, you just won't be around to deal with the mess - enjoy your vacation :-)

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2017-12-15 10:37 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (431 votes). Check out past polls.