my @tmp = @dynval3; while (my ($newname, $name, $val) = splice @tmp, 0, 3) { ... }