[Kc] Perl Quiz of the Week #25 (RPN calculator)

David Nicol davidnicol at gmail.com
Thu Sep 30 00:46:26 CDT 2004

like in FORTH.   Do we need a whole FORTH, or just a RPN calculator?

I think a RPN calculator in perl sounds like a good golf hole

 perl -nle 'if(/\d/){ unshift @S, $_ }else{ $S[0] = eval "$S[0] $_
$S[1]"}; print ++$count,": ",$S[0]'

David L Nicol
getting even worse at mindreading as I get older

More information about the kc mailing list