my( $x_lo, $x_hi ) = ( -180, -170 );
my( $y_lo, $y_hi ) = ( -130, -120 );
my $count = 0;
while (<>) {
my( $x, $y ) = split;
if ( $x >= $x_lo
&& $x <= $x_hi
&& $y >= $y_lo
&& $y <= $y_hi ) {
$count++;
}
}
print "$count matches.\n";
####
my( $x_lo, $x_hi ) = ( -180, -170 );
my( $y_lo, $y_hi ) = ( -130, -120 );
my @matches;
while (<>) {
my( $x, $y ) = split;
push @matches, [ $x, $y ]
if $x >= $x_lo # slighly different syntax,
&& $x <= $x_hi # just to mix things up. :-)
&& $y >= $y_lo
&& $y <= $y_hi;
}
print scalar(@matches), " matches.\n";
####
my( $x_lo, $x_hi ) = ( -180, -170 );
my( $y_lo, $y_hi ) = ( -130, -120 );
my @matches =
grep { $_->[0] >= $x_lo && $_->[0] <= $x_hi
&& $_->[1] >= $y_lo && $_->[1] <= $y_hi }
map [ split ], <>;