my @renames; ... sub wanted { ... push @renames, [ $old_name, $new_name ]; ... } ... find(...); for (@renames) { move $$_[0], $$_[1]; }