Next System Programming in Perl 25

Current directory

        %builtin = (cd => sub { chdir $_[0] 
                                  || warn "Couldn't chdir to $_[0]: $!\n"; },
                    );
        while (1) {
          print "perl% ";
          my $command = <STDIN>;
          last if $command eq '';
          chomp $command;
          my (%command) = parse($command);
          if (defined my $builtin = $builtin{$command{program}}) {
            $builtin->(@{$command{args}});
            next;
          }
          ...
        }


Next 25