in reply to system() not waiting

That is the way that system() behaves. I do not know that this is the best way to address this problem, but if you make your calls in between backtics, the script will wait for the calls to return. You could try this:
if ($filename{$num}ne '') { `/3rdparty/perl/bin/sunos5/lwp-request -p http://proxy-syr +.global.lmco.com $hostname$url -C $user:$password>$temp$file`; `chmod 777 $temp$file`; `acroread -toPostScript $temp$file`; `lp -d ep5_hpp01 $temp *.ps`; }
Or you could also look into the wait function.

Replies are listed 'Best First'.
Re: Re: Wait
by VSarkiss (Monsignor) on Oct 03, 2001 at 00:43 UTC

    Sorry, that's wrong. system waits for its child processes to complete. The big difference between it and backticks is that backticks will allow you pick up the output. Please read the top part of the relevant doc.

    Looks like he just has a typo: Shouldn't the last line be: system("lp -d ep5_hpp01 $temp/*.ps");Presuming that $temp is a directory name. Else it'll glob to any .ps files in the current directory. Otherwise I can't think of why it would appear to be running the commands in parallel.

    HTH

      My bad! Thanks for the correction VSarkiss. I normally do my perl programming on Windows using ActivePerl and I've had some funkiness with using system(). I've just taken to using backticks when it's really necessary to wait until the child is done executing.