use strict; use warnings; my $cutoff = 600; my $c = 0; while (<DATA>) { $c++ if (split /\t/)[0] > $cutoff; } print "$c over $cutoff\n"; __DATA__ 10 alpha 30 bravo 60 charlie 100 delta 500 echo 600 foxtrot 4 golf 22 hotel 900 igloo 800 juliet 999 kilo
Or alternatively:
$c++ if m/^(\d+)/ && $1 > $cutoff;
In reply to Re: Getting the right count
by TJPride
in thread Getting the right count
by dukea2006
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |