On Wed, Oct 2, 2013 at 4:44 PM, Peter Holsberg <pjh42atpobox....@gmail.com>wrote:
> Shawn H Corey has written on 10/2/2013 2:29 PM: > > On Wed, 02 Oct 2013 13:57:36 -0400 > > Peter Holsberg <pjh42atpobox....@gmail.com> wrote: > > > >> <blushing> I was so upset that I deleted it all! It seems to me that > >> it should be fairly straightforward, but at 79, the old synapses > >> aren't firing quite as well as they used to. > >> > >> Can you get me started? > > > > Sure: > > > > my @files = grep { /^\d{6}\.htm$/i } glob( '*.htm' ); > > Well, I'm more of a beginner than I thought I was! > > The /i to grep is to ignore case? > Bit of a misunderstanding there. The /i flag is to the regex, not to grep; might be easier to see if you forgo the grep: my @files; foreach my $file ( glob( '*.htm' ) ) { # foreach file that ends in .htm, if ( $file =~ /^\Q\d{6}.htm\E$/i ) { # if it matches this regex, using \Q...\E to quotes ... and /i to ignore case push @files, $file; # put the files in the array } } > > Why are you globbing *.htm? > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > >