wrote in news:8e4ae12c-3235-4112-a476-2104557c2936
@p31g2000prf.googlegroups.com:
> On Sep 4, 2:07*pm, David Precious <pinkm...@preshweb.co.uk> wrote:
>> backgoo...@gmail.com wrote:
>> > Hello
>>
>> > Does anyone know how to find out whether a file exists or not?
>>
>> if (-f $filename) {
>> * * *# $filename is a file which exists
>>
>> }
>>
>> Full list of tests:http://perldoc.perl.org/functions/-X.html
....
> Let me clarify my question again.
You did not ask a clear question to begin with and this is the first
time you are clarifying the question, so the 'again' above is not
necessary
> I want to search a file I do not know where it is but know its name
> such as "text.exe".
> So I want to check whether or not it is under c:\program file and sub
> folders.
perldoc File::Find
I also like:
http://search.cpan.org/~texmec/File-Find-Iterator-0.4/
#!/usr/bin/perl
use strict;
use warnings;
use Data:

umper;
use File::Find::Iterator;
use File::Spec::Functions qw( canonpath );
my $find = File::Find::Iterator->create(
dir => [ $ENV{TEMP} ],
filter => sub { /t\.pl\z/ },
);
while ( my $found = $find->next ) {
print "$found\n";
}
__END__
--
A. Sinan Unur <>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/