I want to utilize perl from my golang application for regexp purposes. How can I run a perl file and communicate between the two processes? I have tried the package os/exec
but it gave me a pointer as a final value.
I do not think it to be not a good idea to use os/exec
just to use regex. But if you absolutely need to. Run it through os/exec
command and then read it from Cmd.Stdout
and Cmd.Stderr
. For providing inputs you can use Cmd.Stdin
.
You are getting pointer may be because you are not running the command. Is that how you are trying c :=exec.Command('perl')
Also run c.Run()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.