D
Dan
Hi all, I have a Perl script which includes a shell command, I want to
get the return result from this shell command, but when I check the $?
value, it is not correct, can anyone tell me how I can get the return
value?
my perl code:
opendir(DIR, "/log") || die ("Can not open log directory");
foreach $direntry (readdir(DIR))
{
if ($direntry =~ /2007\d{4}/)
{
$ja_request = system("grep -i 'INDEX' $BASE/$direntry/
FILE.log | wc -l");
}
}
Basically, I want to search the "INDEX" string, and count the number
of occurrence in file.LOG file. But the
$ra_request always is 0.
Can anyone help about this, thanks a lot!
get the return result from this shell command, but when I check the $?
value, it is not correct, can anyone tell me how I can get the return
value?
my perl code:
opendir(DIR, "/log") || die ("Can not open log directory");
foreach $direntry (readdir(DIR))
{
if ($direntry =~ /2007\d{4}/)
{
$ja_request = system("grep -i 'INDEX' $BASE/$direntry/
FILE.log | wc -l");
}
}
Basically, I want to search the "INDEX" string, and count the number
of occurrence in file.LOG file. But the
$ra_request always is 0.
Can anyone help about this, thanks a lot!