[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
Re: [FWP] Poor reverse polish calculator
Jeff Pinyan <jeffp@crusoe.net> wrote:
> Making it a 'perl -le', it comes in at
>
> 1 while s!(\S+)\s+(\S+)\s*([-+*/])!"$1 $3 $2"!ee;print
>
> which is 54.
I think you meant 'perl -nle'. But -p saves another six:
perl -ple'1 while s!(\S+)\s+(\S+)\s*([-+*/])!$1.$3.$2!ee'
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
==== Want to unsubscribe from Fun With Perl? Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
==== unsubscribe