Assuming you will always get the line you want:
my $pid = open(my $pipe, 'mDNS -L "Service Name" _service._tcp domain +|'); my $data; while (<$pipe>) { if (/...is desired line.../) { $data = $_; last; } } kill KILL => $pid; print($data);
In reply to Re: How to read from shell command and terminate it afterwards?
by ikegami
in thread How to read from shell command and terminate it afterwards?
by Wen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |