Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: validating file with perl

by mtmcc (Hermit)
on Jul 16, 2013 at 22:23 UTC ( [id://1044669]=note: print w/replies, xml ) Need Help??


in reply to validating file with perl

Maybe this would work:

#!/usr/bin/perl use strict; use warnings; my $fileName = $ARGV[0]; open (FILE, "<", $fileName); my $header = <FILE>; my @countArray = (); my @line; my @allTags; my %results; my $uniqueTag; my $one = "NO"; my $three = "NO"; while (<FILE>) { @line = split(" ", $_); $uniqueTag = $line[0] if @line > 1; if (@line == 2) { $three = "YES" if $line[1] == 3; $one = "YES" if $line[1] == 1; } if ((@line <2) || (eof)) { if (($three eq "YES") && ($one eq "YES")) { $results{$uniqueTag} = "GOOD"; } else { $results{$uniqueTag} = "BAD"; } push (@allTags, "$uniqueTag"); $one = "NO"; $three = "NO"; } } for (@allTags) { print STDERR "$_\t $results{$_}\n"; }

-Michael

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-25 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found