Hi,
I've written a perl script with a nested foreach statement in it.
I have the line
code:
foreach $argn(@arguments) {
foreach $location (@path) {
system("find $location -name \"$argn\" -print >> results.txt");
open\(DATAFILE2, "results.txt"\) || die "cannot find results.txt file";
@results=<DATAFILE2>;
close\(DATAFILE2\);
\#Print results
foreach \(@results\) \{
print;
\}
system\("rm results.txt"\);
\}
}
The problem is the system("find $location -name \"$argn\" -print >> results.txt"); seems to only return the results of system("find $location
and gives �sh: line 2: -name: command not found� error
To test if it was my code, I hardcoded the $location variable and the $argn variable, and that worked fine.
Any ideas why using the argns isn't working?