in reply to Modifying order of a hash

Untested...
foreach my $first ( keys %( $hash1{$key} ) ) { $hash2{ $first }{NextNum} = $hash1{ $key }{ $first }{NextNum}; # etc. }
(I should have used $FileNumber rather than $first; sorry.)

Beware of possible loss of data if you have duplicate NextNum values in %hash1.