in reply to Renames files and directories but won't update files at the same time.

I can't be sure, but I think this is what happened:

When your "update_file_dir" subroutine executes the "rename" function, this does not change the data values that the File::Find methods are giving you, so the original file names are pushed onto the @files array, not the modified file names. If the push had been like this:

-f $_ && push( @files, $concat );
things would have worked better the first time.

Then, in the following "foreach $file (@files)" loop, there is no error checking on "open(IN,$file)" -- if it had been:

unless (open(IN,$file)) { warn "Unable to open $file for modification\n"; next; }
you would have seen the problem with the push, that the old file names were being used instead of the new ones. (But as it was, the open failed quietly, as did the following attempt to read @lines -- no content was ever present in this array on the first run.)

There is a good chance that the open(OUT,">$file") call also failed quietly (there was no error checking there either), because by this time, all the directory names have changed, as well as the file names. This probably saved you from "a fate worse than death" (that's a very apt phrase for this situation).

If opening the old file names for output had succeeded, this would have created a set of empty files with the old file names. Then, when you ran the script a second time, those empty files would have been renamed to the new names, thus obliterating all the original file data. (You do have backups for all those files, don't you?)

Given that this catastrophe was avoided, the second run found all the modified file names, also found that there were no files with the old host in their file names (no renaming required), pushed all the new-host file names onto @files, and the "foreach $file" loop finally worked as intended.

Count your blessings, and thank your guardian angel...

update: Oh, I forgot to mention: when you are engaged in this sort of file manipulation, you really, really should include a lot of error checking, to make sure that things are going the way you intend them to go.