added psh script
This commit is contained in:
20
.scripts/psh
Normal file
20
.scripts/psh
Normal 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";
|
||||
}
|
Reference in New Issue
Block a user