Hi all,

I wrote a code that can search any file/folder on a PC given that you must give the file name with its extension. The code works fine. Any suggestions to make the code better or faster. Here is the code:
--------------------------------------------------------------------------------------------
use strict;
use warnings;
use File::Find;

chdir('/');
print "Enter the name of file/folder to search:\n";
my $fn=<STDIN>;
chomp($fn);
my $dir="\\";
find(\&Wanted,$dir);


sub Wanted
{
if (($_ eq '.')||($_ eq '..')) { } else
{
if ($_ eq $fn)
   {
   my $cwd = Win32::GetCwd();
   print "\nFile found in $cwd";
   }
}
}
------------------------------------------------------------------------------------------

Cheers,
Gunwant Singh

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to