in reply to Re: Grabbing file prefixes with Reg Exp
in thread Grabbing file prefixes with Reg Exp

Didn't you mean to make this a grep? :)
my @files = grep s/\.ram$//i , readdir DH;
Also, I agree with dws regarding the readability of the character classes, and believe you're altogether mistaken regarding the performance issue:
use strict; use Benchmark qw(cmpthese); my $strorig = 'yabadabadooo this bud is a buda fora youa'; cmpthese (-3, { mod => sub { my $str = $strorig; $str =~ m/.*BUD.*/i }, class => sub { my $str = $strorig; $str =~ m/.*[Bb][Uu][Dd].*/ }, }); ## Results (under ActiveState 5.6) ## Rate class mod class 347719/s -- -15% mod 408606/s 18% --
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: Re: Re: Grabbing file prefixes with Reg Exp
by japhy (Canon) on May 14, 2001 at 02:47 UTC
    Yes, it was meant to be a grep() -- I took the map() and modified it, and forgot to change it.

    And I guess I'm mistaken about char classes. I was using information from MRE, I think, which is now oldish, so Perl has probably made some changes.

    japhy -- Perl and Regex Hacker