in reply to Re-ordering data in data file

Obviously, the records need to be reordered along with being renumbered. As far as I can tell, the above "solutions" don't work.
use strict; use warnings; my ($c, %hash); $_ = join '', <DATA>; $hash{$1} = $2 while m/"(\d+)"(.*?{.*?})/gs; print "\"".++$c."\"$hash{$_}\n" for sort {$a <=> $b} keys %hash; __DATA__ "1" { "time: 1247"; "sump: 15"; } "2" { "time: 1255"; "sump: 9"; } "8" { "time: 1350"; "sump: 7"; } "5" { "time: 1600"; "sump: 3"; }