Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: validating file with perl

by kcott (Archbishop)
on Jul 17, 2013 at 10:59 UTC ( [id://1044789]=note: print w/replies, xml ) Need Help??


in reply to validating file with perl

G'day mmittiga17,

Here's my take on a solution:

#!/usr/bin/env perl -l use strict; use warnings; my %good; while (<DATA>) { my ($id, $flag) = split; next unless $id; ++$good{$id}[$flag]; } for (keys %good) { print if $good{$_}[1] && $good{$_}[3]; } __DATA__ 3-2000/7.48 1 3-2000/7.48 2 3-2000/7.48 2 3-2000/7.48 2 3-2000/7.48 2 3-2000/7.48 2 3-2000/7.48 2 3-2000/7.48 3 4-0000/8.40 2 4-0000/8.40 2 4-0000/8.40 2 4-0000/8.40 2 4-0000/8.40 2 4-0000/8.40 2 4-0000/8.40 3

Sample run:

$ pm_id_flag_validation.pl 3-2000/7.48

-- Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-19 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found