Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Selecting a particular record from groups of records

by pvaldes (Chaplain)
on Sep 21, 2012 at 16:57 UTC ( [id://994947]=note: print w/replies, xml ) Need Help??


in reply to Selecting a particular record from groups of records

use strict; use warnings; use List::Util qw(min); my %seahash; my $date; my $time; my $coolflag; while(<DATA>){ next if /^date\/time/; chomp; my ($date, $time, $lat, $lon, $depth, $flag, $coolflag, $otherflag) = + split; # you could need the other variables later, so I save it # print $date, " ",$time, " ", $coolflag,"\n"; # checkpoint push @{$seahash{$date . " " . $time}}, $coolflag; } while (my ($timestamp, $flags) = each (%seahash)) { print $timestamp, " ", min(@{$flags}),"\n"} __DATA__ date/time lat, lon, depth, flag, flag, flag 21-sep-2012 01:00:00 0 0 -200 a 1 c 21-sep-2012 01:00:00 0 0 -100 a 9 c 20-sep-2012 02:20:00 0 0 -1500 a 2 c 20-sep-2012 02:20:00 0 0 -500 a 4 c 20-sep-2012 02:20:00 0 0 -400 a 3 c 20-sep-2012 02:20:00 0 0 -300 a 3 c 10-Aug-2012 02:20:00 0 0 -200 a 3 c 10-Aug-2012 02:20:00 0 0 -200 a 1 c 10-Aug-2012 02:20:00 0 0 -200 a 7 c

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-03-28 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found