On Sat, 24 Mar 2001 at 10:11:08 -0500, Jeff Pinyan wrote: > On Mar 24, Jeff Pinyan said: [a hsiloP calculator] > 1 while s!(\S+)\s+(\S+)\s*([-+*/])!"$1$3$2"!ee;print Your 'perl -le' should be 'perl -ne': perl -ne'1 while s!(\S+)\s+(\S+)\s*([-+*/])!"$1$3$2"!ee;print' which leads to the following trivial optimisation: perl -pe'1while s!(\S+)\s+(\S+)\s*([-+*/])!"$1$3$2"!ee' > 52. Depends how you count. Mine's 55. Or, introducing ASCII dependency (and the possibility of syntax errors) - but you get the [%&,] operators for free: perl -pe'1while s!(\S+)\s+(\S+)\s*([%-/])!"$1$3$2"!ee' BTW1: Using the '.' operator produces some interesting effects when using perl >= 5.6 BTW2: Expressions like 'sin(4) 3 +' are entirely legal... a better solution would allow ' 3 4 sin +' .... [left as an exercise for the reader] Ian ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe