in reply to Search for account number in a file name
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
|
|---|