Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Time Intervals

by jwkrahn (Monsignor)
on Jun 28, 2012 at 00:55 UTC ( #978806=note: print w/ replies, xml ) Need Help??


in reply to Time Intervals

#!/usr/bin/perl use warnings; use strict; open FIN, '<', 'something.csv' or die "Cannot open 'something.csv +' because: $!"; open FOUT, '>', 'something_new.csv' or die "Cannot open 'something_new +.csv' because: $!"; my %data; while ( <FIN> ) { next unless /^(\d+):(\d+):\d+\s+(\d+)$/; my $key = sprintf '%02d%02d', $1, int( $2 / 5 ) * 5; if ( exists $data{ $key } ) { $data{ $key } = [ $., $_, $3 ] if $data{ $key }[ 2 ] < $3; } else { $data{ $key } = [ $., $_, $3 ]; } } print FOUT map $_->[ 1 ], sort { $a->[ 0 ] <=> $b->[ 0 ] } values %dat +a;


Comment on Re: Time Intervals
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://978806]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2014-12-21 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls