Gossamer Forum
Home : General : Perl Programming :

Need help with perl search

Quote Reply
Need help with perl search
Hi,

I would like to write a perl script, which will be provided the values from a HTML form and they will be in the format,

word1 AND/OR word2 AND/OR word3 AND/OR word4

Depending on the AND & OR combination, I wanted to search a directory, having ascii files. It's basically for the technical documents search in my notes directory.

Can I have something like:

foreach $file (@files_in_my_directory)
{ if(/( ((word1) | (word2)) (word3) )/){ print $file}

If yes,
How will I convert the string
word1 AND (word2 OR Word3) into ((word1) (word2|word3))

I am an extreme novice in perl, but familiar with csh programming.

Any help will be appreciated.

-jay