[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Grep based on user input?



On Tue, Dec 19, 2000 at 11:24:16PM -0500, Matthew Fischer wrote:
> How can you dynamically build a grep pattern based on user input from a form?
> 
> i.e.: (I know this doesn't work):
> 
>   if ($input{'month'} ne "") {
>       @allfiles = grep(/$input{'month'}/,@allfiles); 
>       }

It doesn't?  Looks okay to me, although the user could enter a regex that
doesn't compile.  Use eval {} to trap errors.

Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org