Tuesday, December 1, 2015

Perl6: run and shell

   run 'echo', "hello Tuesday!"; # external command, no shell
   shell 'ls -ltr';              # runs via system shell.


(When using "shell", metacharacters are interpreted by the shell, including pipes, redirects, environment variable substitutions, etc.)

$ perl6 shell.pl6
hello Tuesday!
total 48
-rw-r--r--  1 rje  501   54 Nov 29 18:10 hello.pl6
-rw-r--r--  1 rje  501  268 Nov 30 07:37 arrays.pl6
-rw-r--r--  1 rje  501  281 Nov 30 07:43 control.pl6
-rw-r--r--  1 rje  501  505 Nov 30 07:49 for.pl6
-rw-r--r--  1 rje  501  264 Nov 30 08:04 input.pl6
-rw-r--r--  1 rje  501   71 Dec  1 08:06 shell.pl6

2 comments:

  1. I'm enjoying your posts. I've been curious about Perl 6 but have not taken the time to learn it. This way, I can just look over your shoulder while you learn it.

    ReplyDelete
  2. I've been too skittish about learning Perl 6, because it seemed to change fundamentally each year... and has taken forever to finally get here.

    ReplyDelete