[OT] perl help on number modification

Gianluca Cecchi gianluca.cecchi at gmail.com
Tue Jan 19 16:57:31 UTC 2010


On Fri Jan 15 23:04:38 UTC 2010, Bill Davidsen wrote:
> Does that do what you want? I would think that you want "1." to become just "1"
> as well.
>
> In perl: perl -e 'while(<>) { s/[.0]+$//; print "$_\n" }'

Ok Bill, this is unlikely to happen, as I get values from another
application and in case of integer values it outputs with .00
extension.
But for the sake of precision (or if in the future I would go and
catch up this part of code for another reason... more likely to happen
;-) you are right and I changed the regex in my script.

BTW also the second suggestion by Jake worked; it only was with more
typed characters....
Thanks again


More information about the users mailing list