Perl 5.18 compatibility: don't iterate the copy to be modified, but the
original, copying it value by value instead.