tau1777 has asked for the wisdom of the Perl Monks concerning the following question:
Hello all,
I am trying to use backticks like so: my @result = `command --arg1=$num1 --arg2=file.log . . . -argLast=$numLast`;
I can see from the log file that the command is processing and on some occaisions I have even seen the log file say the command was finished, however the rest of my perl script does not run, instead the command starts to run again.
I was thinking about adding something like exit if $?=0 inside of the backticks to force the script to move on, but I think this not quite right. I've read that backticks are supposed to hand over control to the parent script after it runs so I really don't even want to force it to continue.
Any thoughts on what might be going on?
I'm sorry for asking such a basic question and vague questions. I will try to provide any details you would like. But unfortunately I didn't write all of this code, and it is sort of privately owned, so I can't exactly put up the code verbatim.
Thanks very much.
Thank you all so much for your help. I figured out what was wrong thanks to, Anonymous-Monk (01:34 UTC).It turns out there was a for loop in my code. It was about 500 lines up. I did not notice it before beacuse the original perl script that I am manipulating called an old suite of C programs that we no longer use. Using the old stuff each loop finished in 2-5 seconds. Now that we make calls to a new set of C code each for loop takes 2000s. This is certainly not an improvement and something else I have to look into.
Thank you again.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Backtick caught in infinite loop
by zentara (Cardinal) on Jun 20, 2014 at 01:26 UTC | |
by tau1777 (Initiate) on Jun 20, 2014 at 02:22 UTC | |
by zentara (Cardinal) on Jun 20, 2014 at 13:17 UTC | |
|
Re: Backtick caught in infinite loop
by Anonymous Monk on Jun 20, 2014 at 01:34 UTC | |
by tau1777 (Initiate) on Jun 20, 2014 at 02:29 UTC | |
|
Re: Backtick caught in infinite loop
by Anonymous Monk on Jun 20, 2014 at 15:24 UTC | |
by tau1777 (Initiate) on Jun 21, 2014 at 18:11 UTC |