On 3/9/06, John W. Krahn <[EMAIL PROTECTED]> wrote:
> Brian Poellnitz wrote:
> >
> > The sample data below is read into a list, @dir_files. What I'd like
> > to do is grep() the list so that I'm left with only files that end in
> > ".wav" and contain certain string. The "certain string" is where I
> > run into problems. Something like
> >
> > grep(/.*\.wav/)
> >
> > works fine for getting the items with .wav extensions. What I'd like
> > to do is also filter for the existence of a string held in the
> > variable $feed_date (In my test case, $feed_date = "9mar"). I've
> > tried something like
> >
> > grep(/.*($feed_date).*\.wav/)
> >
> > but with no luck. My resultant list is empty. Can someone nudge
> > (shove?) me in the right direction?
>
> grep { /_${feed_date}_/ && /\.wav$/ } @dir_files;
>
>
>
> John
Why two matches instead of just 'grep {/_${feed_date}_.*?\.wav$/} @dir_files' ?
Are the two shorter matches more efficient than a single one for some reason?
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org
values of β will give rise to dom!