Are you using this in conjunction with Perl's 'opendir' function to search a directory for an account record? Do all of the files have the same file extension (.txt)?
A simple solution might be something like:
my $accountsearch = <STDIN>;
chomp $accountsearch;
my $dir = '/path/to/records';
opendir (DIR, $dir);
my @records = readdir(DIR);
closedir (DIR);
if (/.*$accountsearch.*\.txt/ ~~ @records) {
print $&, "Was found\n";
} else {
print "No record found for that account number\n";
}
This is just my first thought solution and I am by no means a perl monk. Just giving my 2 cents :D