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
In reply to Re: (Beginner) Return number of variables within a set distance.
by toolic
in thread (Beginner) Return number of variables within a set distance.
by Halbird
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |