On Mon, Jun 30, 2003 at 06:51:50AM +0800, LI NGOK LAM wrote:

[ Reformatted a bit ]

> FILE:
> for my $file (@filelist) {
>    local $_ = $file;
>    chomp;
>    s/^$root//; 
>    for my $filter (@FFW, @FFO) {
>        next FILE if /$filter/i;
>    } 
>    push @ret, $file;
> }
>
> The problem is if I give @FFW or @FFO a values like ('.txt', 
> '.doc') the regex won't take care of the '.'

I think you're looking for \Q, which automatically escapes
regex metacharacters like dot (".")

     for my $filter (@FFW, @FFO) {
         next FILE if /\Q$filter/i;
     }

Notice that the label ("FILE") lets you jump to the next 
iteration of the outer loop.

-- 
Steve

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to