in reply to Shell v Perl, here-doc as stdin
I am not sure what you are asking exactly but here are a few possibilities.
As mentioned the here-document syntax is supported inside perl programs for data.
If you are wanting to send some input to 'system_command' then this could look really similar to a shell.
open FH, "|system_command"; print FH <<EOF EOF
The | in front of the command tells perl to send anything printed onto that filehandle along to the program. Also if you have a newer perl you can use the 3 element open and lexical filehandles so the open could look more like:
open my $fh, "|-", "system_command";
Of course, in perl, TIMTOWTDI, so you can also have a variable with content to be passed along.
open FH, "|system_command"; my $stuff="some things to pass along to system command\n"; print FH $stuff;
A perl script can be passed input via a here-doc from the shell just like any other command can recieve this data.
I hope one of these addresses the question that you had.
|
---|