in reply to (Beginner) Return number of variables within a set distance.

You can increment the count as you read lines from your input file:
use warnings; use strict; my $cnt = 0; while (<DATA>) { chomp; my ($an, $dist) = split; $cnt++ if $dist < 10; } print "cnt=$cnt\n"; __DATA__ a 50 b 15 c 9 d 11 e 33 f 2

Prints:

cnt=2

Replies are listed 'Best First'.
Re^2: (Beginner) Return number of variables within a set distance.
by Halbird (Novice) on Mar 26, 2015 at 01:45 UTC
    That's very useful. Thank you so much!