If you want to change the string in place, you can use
s///ge:
use warnings;
use strict;
my $content = '{ "geometry": { "type": "Polygon", "coordinates": [ [ [
+ 19.054804912278406, 47.485785556135411 ], [ 19.057857836771483, 47.4
+87322542030711 ], [ 19.06025597925397, 47.488491565765209 ], [ 19.060
+347248086835, 47.488539642204628 ], [ 19.060463310421543, 47.48457828
+7406251 ], [ 19.054804912278406, 47.485785556135411 ] ] ] } }';
$content =~ s/(\d\d\.\d*)/substr($1,0,9)/ge;
print "$content\n";
__END__
{ "geometry": { "type": "Polygon", "coordinates": [ [ [ 19.054804, 47.
+485785 ], [ 19.057857, 47.487322 ], [ 19.060255, 47.488491 ], [ 19.06
+0347, 47.488539 ], [ 19.060463, 47.484578 ], [ 19.054804, 47.485785 ]
+ ] ] } }
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.