Error executing shell command from a perl script

Hi Gurus,
I've a find command that gets the list of files from a source directory where the extension is not html, xml, jsp, shtml or htaccess. The below find command runs fine from the command prompt or in a shell script. I need to eventually run it in a PERL script and am getting the following error when run from perl script.

`find <Source-dir-path> ! \( -name '.html' -o -name '.xml' -o -name '.jsp' -o -name '.shtml' -o -name '*.htaccess' \) -type f -print`;

sh: syntax error at line 1 : `(' unexpected

Running out of fuel and would appreciate any help or suggestions to make this work.

Thanks

try using :

system ("find <Source-dir-path> ! \( -name '*.html' -o -name '*.xml' -o -name '*.jsp' -o -name '*.shtml' -o -name '*.htaccess' \) -type f -print");

The error you got is most probably related to un-escaped symbols, missing quotes, etc.
Or if you want to use the backthicks, put "" around them.

Thanks for your response. I tried using system ("find <Source-dir-path> ! \( -name '.html' -o -name '.xml' -o -name '.jsp' -o -name '.shtml' -o -name '.htaccess' \) -type f -print"); but that reported the same syntax error. I noticed that perl was eliminating the '\', so to get over the issue I used '\\' like indicated below and it worked like charm
`find <Source-dir-path> ! \\( -name '
.html' -o -name '.xml' -o -name '.jsp' -o -name '.shtml' -o -name '.htaccess' \\) -type f -print`;

Perl has a module used for this purpose File::Find which should be more efficient than shelling out to the find command. It is also easy enough to code if you don't need to search sub directories

opendir (DIR,'path/to/folder') or die "$!";
my @files = grep {-f "path/to/folfer/$_" && !/\.html$|\.xml$|\.jsp$|\.shtml$|\.htaccess$/} readdir DIR;
close DIR;
print "$_\n" for @files;

i too have some problem with command source..

system("source set_file");
if ( $? == -1 )
{
print "command failed: $!\n";
}
else
{
# printf "command exited with value %d", $? >> 8;
print "set\n " ;

}

After running this. Im getting following error:
-1
command failed: No such file or directory

it giving error although the file exists.

can somebody help me how to operate source command using system function in perl.

source isn't a system command, but a shell-internal, telling it to read the given script in the current shells context. To check this, at the command prompt enter

$ which source
$ type source
$ type .

If you get anything but "is a shell builtin" or "not found", I'd be very surprised.

Try running it as

system("/usr/bin/ksh set_file");