PerlBear has asked for the wisdom of the Perl Monks concerning the following question:
shown above is my blind (lack of knowledge) attempt which obvoiusly didn't work. Originally the grep line was just set to match just the extension,my $datadir="/user1/localfiles/data/" opendir LOCALDIR, "$datadir" or die "unable to open $datadir\a\n"; my @localfiles=grep/(^file-15a_62_200405)&&(.txt$)/i readdir LOCALDIR; foreach my $file(@localfiles) { print "$file\n"; }
or I could match the beginning with:my @localfiles=grep/.txt$/i readdir LOCALDIR;
which worked just fine. In a nutshell.... I simple do not know how to combine the two. I would really appreciate your help in this matter and I humbly thank you in advance.my @localfiles=grep/^file-15a_62_200405/i readdir LOCALDIR;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Simple Regular Expression Help Needed
by tlm (Prior) on May 24, 2005 at 16:03 UTC | |
|
Re: Simple Regular Expression Help Needed
by thundergnat (Deacon) on May 24, 2005 at 16:08 UTC | |
|
Re: Simple Regular Expression Help Needed
by prasadbabu (Prior) on May 24, 2005 at 16:03 UTC | |
|
Re: Simple Regular Expression Help Needed
by northwind (Hermit) on May 24, 2005 at 16:04 UTC | |
by Tanktalus (Canon) on May 25, 2005 at 13:19 UTC | |
by northwind (Hermit) on May 25, 2005 at 17:37 UTC |