Dear Monks & others,
I don't understand what happens in the script below. Why does the output get jumbled as soon as I remove the comment before my $processes = `ps au`? I would have expected everything inside the child process to run in order, but it looks like the part between the backticks is running asynchronically or something???
This is part of a much larger script in which I need to extract some information from 'ps au' to be used in the script.for (1..3) { my $fork_pid = fork(); if (! $fork_pid) { print "hello" . "\t"; # my $processes = `ps au`; print "world" . "\n"; exit 0; } }
In reply to Backticks within child process by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |