#! /usr/bin/perl -w use strict; use warnings; use Cwd; my $dir = '.'; if (@ARGV == 1) { $dir = $ARGV[0]; } while (<$dir/ReportID*>) { open(FILE, $_) or die $!; my $name = $_; while () { if ( /InsideDiameter=(\d+)/ ) { if ($1 > 1000 && $1 < 1100) { print "$name\n"; } last; } } }