in reply to Grabbing file prefixes with Reg Exp

The parentheses grab into $1, but grep works with $_.

Also, there is a problem with your regular expression. It will match any file containing .ram, not just files ending in this extension.

Be aware that as you are matching case insensitively, your regexp will also match files containing the string .RAM or .rAm. I'm assuming this is okay. Try:

my @audiofiles = grep { s/\.ram$//i } readdir DH;

Replies are listed 'Best First'.
Re: Re: Grabbing file prefixes with Reg Exp
by nysus (Parson) on May 13, 2001 at 20:32 UTC
    Good catch and an interesting solution. Muchos gracias.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar";
    $nysus = $PM . $MCF;