in reply to how to check whether a particular word exists in filename

I want only .txt should display not A1.txt, how can i exclude the that

* is a quantifier in regex, you probably did not mean to use it there.

This might do: if ( $file =~ m/^CHECK.*\.txt$/ and $file !~ m/A1\.txt$/ ) { ...

!~ to negate the "A1.txt" part.

Cheers, Sören

(hooked on the Perl Programming language)