use strict;
my $str = '{ok_sock_to_host_close_10.205.148.134:32001=6, ok_sock_to_host_ssl1zn3-m1-ap.ssodev-bo.mtv1.vrsn.com:32001=6, ok_sock_to_host_10.205.148.134:32001=6, ok_sock_to_host_127.0.0.1:8080=5, ok_permit_to_host_acquired_127.0.0.1:8443=5, ok_sock_to_host_real_open_ssl1zn3-m1-ap.ssodev-bo.mtv1.vrsn.com:32001=2, ok_sock_to_host_real_open_10.205.148.134:32001=2, ok_permit_to_host_acquired_10.205.148.134:32001=6, fail_sock_to_host_127.0.0.1:8443=5, ok_permit_to_host_released_127.0.0.1:8080=5, ok_sock_to_host_real_close_ssl1zn3-m1-ap.ssodev-bo.mtv1.vrsn.com:32001=2, ok_sock_to_host_real_close_10.205.148.134:32001=2, ok_sock_to_host_close_ssl1zn3-m1-ap.ssodev-bo.mtv1.vrsn.com:32001=6, ok_sock_to_host_real_open_127.0.0.1:8080=5, ok_sock_to_host_real_close_127.0.0.1:8080=5, ok_sock_to_host_close_127.0.0.1:8080=5, ok_permit_to_host_released_127.0.0.1:8443=5, ok_permit_to_host_released_ssl1zn3-m1-ap.ssodev-bo.mtv1.vrsn.com:32001=6, ok_permit_to_host_acquired_ssl1zn3-m1-ap.ssodev-bo.mtv1.vrsn.com:32001=6, ok_permit_to_host_acquired_127.0.0.1:8080=5, ok_permit_to_host_released_10.205.148.134:32001=6}';
my $regex = qr/([\w\.:-]*)=(\d)+(,|})/p;
my $subst = '"\\1":\\2\\3';
my $result = $str =~ s/$regex/$subst/rg;
print "The result of the substitution is' $result\n";
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html