#Perl5
$rpn = "3 10 * 20 5 / +";
$dig = qr/-?\d+\s+/;
$op = qr/[+\-*\/]/;
%f = ("+" => sub{$_[0] + $_[1]},
"-" => sub{$_[0] - $_[1]},
"*" => sub{$_[0] * $_[1]},
"/" => sub{$_[0] / $_[1]});
1 while($rpn =~ s/^(.*?)($dig)($dig)($op)/$1.($f{$4}->($2,$3))/e);
print "$rpn\n";
##```
##
//Haskell
main = print $ foldl eval [] $ words "3 10 * 20 5 / +" -- 34
eval (x:y:xs) "+" = y+x : xs
eval (x:y:xs) "-" = y-x : xs
eval (x:y:xs) "*" = y*x : xs
eval (x:y:xs) "/" = y`div`x : xs
eval xs dig = (read dig):xs
```