How can I run external programs using Perl 6? (e.g. like “system” in Perl 5)

前端 未结 2 1920
迷失自我
迷失自我 2021-01-18 19:02

I can use system in Perl 5 to run external programs. I like to think of system like a miniature \"Linux command line\" inside Perl. However, I cann

2条回答
  •  不要未来只要你来
    2021-01-18 20:06

    In addition to using shell or run, which replace system from Perl 5, you can also use NativeCall to invoke the libc system function.

    On my Windows box, it looks like this:

    use NativeCall;
    sub system(Str --> int32) is native("msvcr110.dll") { * };
    system("echo 42");
    

提交回复
热议问题