in reply to Rounding numbers in a string

I'd use the /e modifier to include code into substitution directly:

while (<>) { s/ ([XYZA]) ([-+]?) ([0-9.]+) /sprintf "%s$2%.3f", $1, $3 /gex; print; }

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Rounding numbers in a string
by fauve (Novice) on Oct 01, 2016 at 11:36 UTC

    Wow, this is just beautiful! Thanks from me, and my controller too :) Seriously, thank you!