added operator %

This commit is contained in:
Peter J. Holzer 2013-05-05 19:35:11 +02:00
parent ac9719ad57
commit 15cf3dcafb
1 changed files with 1 additions and 1 deletions

2
rpn
View File

@ -10,7 +10,7 @@ my $stack_color = 'blue';
print color $input_color; print color $input_color;
while (<>) { while (<>) {
for (split) { for (split) {
if (m{^[-+*/]|\*\*$}) { if (m{^[-+*/%]|\*\*$}) {
my $y = pop @stack; my $y = pop @stack;
my $x = pop @stack; my $x = pop @stack;
my $z = eval "$x $_ $y"; my $z = eval "$x $_ $y";