As I understand (Perl is new to me) Perl can be used to script against a Unix command line. What I want to do is run (hardcoded) command line calls, and search the output of these calls for RegEx matches. Is there a way to do this simply in Perl? How?
EDIT: Sequence here is: -Call another program. -Run a regex against its output.
The
qx//quasi-quoting operator (for which backticks are a shortcut) is stolen from shell syntax: run the string as a command in a new shell, and return its output (as a string or a list, depending on context). Seeperlopfor details.You can also open a pipe:
This allows you to (a) avoid gathering the entire command’s output into memory at once, and (b) gives you finer control over running the command. For example, you can avoid having the command be parsed by the shell:
See
perlipcfor more details on that.