in reply to trouble with system calls

hello, Please enlighten me about what could be wrong with the following :
chdir("/home/code/"); system("svm_classify zkereigenout.dat svmmodel.mod"); open(IN,"<svm_predictions"); @values = <IN>; close(IN);
svm_classify is a program that produces an output file named svm_predictions. after my system call, i want to read the content of svm_predictions and assign it to the array named values. however, when I check the directory, svm_predictions does not exist... I made sure that the directory has the right permissions...thanks a lot!

janitored by ybiC: Reparented this (originally root) node into prior thread on same topic/question by same OP, and retitled accordingly

Replies are listed 'Best First'.
Re: (2) trouble with system calls
by Zaxo (Archbishop) on Feb 10, 2004 at 07:56 UTC

    Try it with

    use Cwd 'chdir'; #...
    That will make chdir's effect be felt in your environment, where a shell is likely to look for the base for relative paths. You may find your missing 'svm_predictions' in your original start directory.

    Update: ysth++ spotted a typo in code. Corrected.

    After Compline,
    Zaxo

Re: (2) trouble with system calls
by borisz (Canon) on Feb 10, 2004 at 09:39 UTC
    Perhaps svm_classify is not found. Try
    system("svm_classify zkereigenout.dat svmmodel.mod") == 0 or die "$? $ +!";
    Boris
Re: (2) trouble with system calls
by chimni (Pilgrim) on Feb 10, 2004 at 10:19 UTC
    Are you running the script from the same directory as svm_classify
    If not maybe svm_classify cannot be found
    echo $PATH ,should tell you what all is included
    else use the full path of the program.
    It would be a good idea to use die as above in order to get an error message: does it say cannot find file or some such.
    HTH,
    chimni