added psh script

This commit is contained in:
hellerve
2016-05-02 19:43:36 +02:00
parent 3cad0f27ad
commit c711ce1dc8
5 changed files with 24 additions and 1 deletions

20
.scripts/psh Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/perl
print "Hi. This is a perl prompt.\n";
print "Type a Perl expression to be evaluated here\n";
print "or exit using \"exit\" or Ctrl-C.\n\n";
sub get_line {
$| = print "> ";
readline();
}
while (defined($line = get_line())) {
chomp $line;
if ($line eq "exit") {
print "Bye for now!\n";
exit;
}
my $result = eval $line;
print "=> $result\n";
}