Execution problems with Find

the below cmd is not wrking in perl script

find . -name "*e*" -exec wc -l {} \;

its show the following error

Can't modify system in scalar assignment at prjt.pl line 4, near ");"
Execution of prjt.pl aborted due to compilation errors.

can you please give me complete code

this is my complete code.

its working individual, but not working n perl script .

 
find . -name "*e*" -exec wc -l {} \;

---------- Post updated at 04:46 AM ---------- Previous update was at 03:03 AM ----------

HI All,

  can any one help me to slove this issues

Yeah show us how did you use it in Perl code.

If it is the only line, then why does the error says 4th line ?
Also you cannot use find command directly in perl program.. you have to atleast back tick it or use system..

Where is your perl code?

this is my perl code

 
 
#!/usr/bin/perl
system = ("find . -name '*e*' -exec wc -l {} \;");

error is

Can't modify system in scalar assignment at prjt2.pl line 2, near ");"
Execution of prjt2.pl aborted due to compilation errors.

You're trying to assign something to a command. Remember, variables in Perl always have to be prefixed by one of '$', '@', '%' for scalars/arrays/hashes.

thanks pludi , but

i tryed this code also

#!/usr/bin/perl
@system = ("find . -name '*e*' -exec wc -l {} \;") ;

no output from this too pludi

Try this

system ("find . -name '*e*' -print0 | xargs -0 wc -l | egrep -v total\$");

The green part is optional, it would just remove the last line displaying the total.

thanks pseudocoder, but its not working

following error is coming

 
find: bad option -print0
find: [-H | -L] path-list predicate-list
xargs: illegal option -- 0
xargs: Usage: xargs: [-t] [-p] [-e[eofstr]] [-E eofstr] [-I replstr] [-i[replstr]] [-L #] [-l[#]] [-n # [-x]] [-s size] [cmd [args ...]
system ("find . -name '*e*' -exec wc -l {} \\;");

thnks a lot pseudocoder

its working