How to Redirect Output to Input in Perl
When Perl generates output in a script, it is often useful to redirect that output back into the script so it can be used as input for another function. This type of redirection is done with a simple but powerful symbol that is used to redirect output from virtually any source and pump it into the input field of another function or processing unit.
Instructions
-
-
1
Open your Perl script.
-
2
Set up your output function as a variable. For example
myOutVariable
-
-
3
Create a new variable to accept the output as input. For this example
new Var myInVariable;
-
4
Send the output from the first variable into the second through the "pipe" symbol:
myOutVariable | myInVariable
-
1
Tips & Warnings
This method can be used with function inputs and outputs as well.