Without knowing what the code looked like without the match, I'm guessing, but if you just remove the match and it's associated block, then you are using two different variables in different scopes both named $pid, the assignment just after the sleep will go out of scope at the end of that block, and the other $pid (which is the one the while is checking) will never change, so the loop will never end.
If you remove the match block, and also remove the my from the assignment just before it then it should work, although I'd probably do it something like this instead...
#!/usr/bin/perl -w # # cat data obtained from collector script use strict; while ( my $pid = `pgrep -f _collectDataScript.pl` ) { print "Waiting for process $pid"; sleep(10); }
| We're not surrounded, we're in a target-rich environment! |
|---|
In reply to Re: process management
by jasonk
in thread process management
by semio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |