gil_elad has asked for the wisdom of the Perl Monks concerning the following question:

i need to know what version of perl do i need in order to work with Data center on win 2000. when i run some lines from a perl script ,the os ignores it, but if i do it manually through the command window it works. when i run the script on another machine(not on datacenter) it works. here are two examples from the script: 1. system ("SQL < calfile.txt "). the file calfile.txt is a valid sql commands 2. any system command that contains the %% sign is ignored.

Replies are listed 'Best First'.
Re: Datacenter and Perl
by bwana147 (Pilgrim) on Jun 07, 2001 at 12:51 UTC

    system takes a command as its first argument and the command-line arguments to that command as its next arguments. Well, it might not be that clear... Here an example:

    system("SQL", "<", "calfile.txt");

    Now, I don't know too much how MSDOS parses its command-line, but if it is like a Unix-shell, I/O redirections are not part of the command-line. Which means that the code above won't work.

    If SQL accepts to have commands piped into it, you can try something like:

    open IN, "<calfile.txt" or die "Aaargh: $!\n"; open OUT, "|SQL" or die "Ooops: $!\n"; print OUT, <IN>; close OUT; close IN;

    And what is this double percent sign, and where are you trying to use it? On MSDOS command-line, in system,...?

    HTH
    --bwana147

      regarding the %% sign; i use it in system command.
Re: Datacenter and Perl
by Beatnik (Parson) on Jun 07, 2001 at 12:53 UTC
    I vaguely remember something similar :)
    system returns a status code, you're not grabbing it. My guess is that you're probably not using a complete path. Try passing parameters as if they are parameters:
    $status = system("command","param1","param1");
    or if you don't need the status code, just the return values, you could consider qx()

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.