Spencer_Lists <> wrote:

: my @files = <$path/*>;
: my $file_exists = 1 if (grep/$newname/,@files);

    Have you tried using \Q to escape the special
characters in $newname?

 my $file_exists = 1 if grep /\Q$newname\E/o, @files;


    As an alternative you could stop using a regular
expression for the match (untested code).

 my $file_exists = 1 if grep $_ eq $newname, @files;


    And if you need multiple tests, you could use a hash
(untested code).

 my %file_exists;
 @file_exists{ @files } = (1) x @files;

 if ( $file_exist{ $newname } ) {
     # do something
 }




HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to