in reply to pass variable to another process when invoking from command line
Say you call the second program from the shell, not the first one. How does it expect the input? It's probably one of these two:
second_program filename # as a command line option echo "filename" | second_program # piped into its standard input
When calling second_program, you need to do one of these:
system "./second_program", $filename and die ... # pass it on the comm +and line # note, system needs +"and" for error checking open my $fh, "| ./second_program" or die ... # via stdin print $fh $filename; # (note, no comma on +this line)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |