learner@perl has asked for the wisdom of the Perl Monks concerning the following question:
i am reading file names from the directory and i am putting some conditions while reading a file names
if ( ( $file =~ m/^CHECK*/ ) && ( $file =~ m/.txt$/ ) ) { print "name is = $file\n"; }
The file names in directory are like
CHECK_CH.ABC12_A1.txt CHECK_CH.ABC12.txt
I want to read all the files with first word as CHECK and last word as .txt
I want only .txt should display not A1.txt, how can i exclude the that
any suggestions please
but when i execute the code,i am getting all the files .txt and A1.txt
The output is
CHECK_CH.ABC12_A1.txt CHECK_CH.ABC12.txt
I am expecting output as:
CHECK_CH.ABC12.txt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to check whether a particular word exists in filename
by Happy-the-monk (Canon) on Jul 03, 2013 at 19:22 UTC | |
|
Re: how to check whether a particular word exists in filename
by kennethk (Abbot) on Jul 03, 2013 at 19:24 UTC | |
|
Re: how to check whether a particular word exists in filename
by Laurent_R (Canon) on Jul 03, 2013 at 22:04 UTC | |
|
Re: how to check whether a particular word exists in filename
by kcott (Archbishop) on Jul 04, 2013 at 04:22 UTC | |
|
Re: how to check whether a particular word exists in filename
by Preceptor (Deacon) on Jul 03, 2013 at 19:24 UTC | |
by ww (Archbishop) on Jul 03, 2013 at 22:55 UTC | |
by Happy-the-monk (Canon) on Jul 03, 2013 at 23:30 UTC | |
|
Re: how to check whether a particular word exists in filename
by Shuraski (Scribe) on Jul 04, 2013 at 15:20 UTC |