in reply to Re^2: I think I just found a good reason to use backticks in a void context.
in thread I thought I found a good reason to use backticks in a void context, but I was wrong.

I think merlyn's point is that in the OP, you seem to be claiming that it is using backticks itself which makes the progam faster, whereas he is pointing out that the actual cause is the lack of metacharacters. So if you were to use system instead of backticks, but still without redirection or other metacharacters, you would get the same benefit. Therefore it's not really fair to claim that the backticks made the difference.
  • Comment on Re^3: I think I just found a good reason to use backticks in a void context.

Replies are listed 'Best First'.
Re^4: I think I just found a good reason to use backticks in a void context.
by OfficeLinebacker (Chaplain) on Jan 14, 2007 at 02:10 UTC

    I agree that if I had used system(), only with no redirection, the performance would probably be the same. I didn't try that, but I did try backticks WITH redirection and got a similar penalty (or loss of efficiency?) to using system() with redirection. I noted that in an update to the OP. I am sorry if I was unfair.

    Tell me, is the following an accurate characterization:

    By using backticks, I am effectively making the inside of my program the system call's STDOUT. Using backticks in a void context is the functional equivalent of redirecting output of the system call to /dev/null. With backticks, the computer has to do less work (and the programmer has to do less typing).

    I don't mean to endorse of the practice by the above statements.


    I like computer programming because it's like Legos for the mind.