I have an existing perl script (which i cannot modify) which has two STDIN calls. I would like to run this perl script from a powershell script and feed it the two "user inputs" but using variables.
For a single input I tried
'input' | perl <file_path>.pl
This correctly uses the 'input' as the first value of the STDIN call. The issue is it only works once.
How can I pass two sets of STDIN inputs via the powershell script?
You are asking how to provide two lines to the STDIN of a program in PowerShell.
You can use either of the following:
Demo:
Note that a BOM gets added by PowerShell 5. No idea how to prevent that. This is not the case with newer versions of PowerShell.