Aside from the (excellent) solutions proposed here, which explain how to do this in Perl, you could also wrap the three lines you presented us, in a shell script and invoke this script in the usual way (using backticks) from Perl.
In reply to Re^3: How to read from shell command and terminate it afterwards?
by rovf
in thread How to read from shell command and terminate it afterwards?
by Wen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |