On Fri, 18 Jan 2002, Jonathan E. Paton wrote:

> For those who haven't met RPN, or are looking for a Perlish
> impliementation here is a better (working) one than I
> posted earlier:

Here is something I wrote in december, while experimenting stuff.

sub p($){@$=eval"(".'pop@%,'x$_[0].")"}@%{'.','='}=(sub{print
pop@%},sub{print"@{%}"});for(qw'+ - * / %'){$%{$_}=eval'sub{p
+2,push@%,pop(@$)'.$_.'pop@$}'}$\=$/;while(<>){chomp;for(split
){exists($%{$_})?&{$%{$_}}:push@%,$_}}

It's not really obfuscated, doesn't check for errrors, could
probably be shorter. Nothing fancy, really.

Operations : + - * / %
.. pops and print one item from the stack
= prints the whole stack

        Enjoy,

-- 
 Philippe "BooK" Bruhat

 Even when the words are true, they may not speak the truth.
                                    (Moral from Groo The Wanderer #70 (Epic))

Reply via email to