[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Poor reverse polish calculator



On Mar 24, Jeff Pinyan said:

>  1 while s!(\S+)\s+(\S+)\s*([-+*/])!"$1 $3 $2"!ee;print
>
>which is 54.

Kick me for introducing a bit of readability into that.

  1 while s!(\S+)\s+(\S+)\s*([-+*/])!"$1$3$2"!ee;print

52.

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe