Remember, the $ForVar1 is inside a regex. You need to write your wildcards in regex syntax foreach $ForVar1 ("ctr","e..","frm","fmx","i..","lgo" wantor > -----Original Message----- > From: Dirk Bremer [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 04, 2001 11:37 AM > To: perl-win32-users > Subject: Grep Help > > > I was following the thread glob vs. readdir and changed one > of my scripts to readdir: > > # Clean-up the job/coop's directories. > foreach $ForVar1 ("ctr","e??","frm","fmx","i??","lgo") > { > unless > (chdir("$RootDir/$Coop/$JobName/$CoopDir/")) {next;} > opendir(GLOB,".") or die "Cannot open current > directory $!, stopped"; > @Result = grep /\.$ForVar1/, readdir(GLOB); > closedir(GLOB); > if (@Result) > { > foreach $ForVar2 (@Result) > { > print("$ForVar1:$ForVar2\n"); > # del("!q $ForVar2"); > } > last; > } > } > > I am having a problem with the grep function. It returns all > of the files in the directory instead of the specified file > extensions. > It appears that grep does not recognize the value in > $ForVar1. Any suggestions? > > Dirk Bremer - Systems Programmer II - AMS Department - NISC > 636-922-9158 ext. 652 fax 636-447-4471 > > <mailto:[EMAIL PROTECTED]> > > > _______________________________________________ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users