in reply to using variable inside system call

i don't know what a node is in your example, but what doesn't work and what error message do you get?
generally, system() with a list as parameters is safer than a string, so maybe calling
system(qw(wrunprb * * *), $node); will work. but that's just a guess.
i suppose $[node] is just a typo...

update: ah, i didn't recognize the single quotes. anyway, $[node] is a syntax error.

Replies are listed 'Best First'.
Re: using variable inside system call
by Abigail-II (Bishop) on Apr 02, 2004 at 15:39 UTC
    Well, calling system with a list as parameters isn't necessarely 'safer'. It means that the shell is bypassed. Since you don't know what's inside $node, you don't know whether it matters or not. Perhaps $node contains whitespace, or backticks, or dollar signs, making it vital that the shell plays it part.

    Don't suggest alternatives without pointing out what may break.

    Abigail

      Well, calling system with a list as parameters isn't necessarely 'safer'.

      ok, granted, i meant 'in most cases'. in most cases you don't need the shell. i think. (!)

      Since you don't know what's inside $node, you don't know whether it matters or not.

      that's what i said. i said i don't know what's a 'node' supposed to be. i stated clearly that i'm making a guess.

      Don't suggest alternatives without pointing out what may break.

      if i always pointed all things that could possibly go wrong i wouldn't have time for anything else. what is perlmonks all about if i can't suggest alternatives when i state at the same time that i'm guessing? ok, a link to the system() function would have been nice.