sub update_file { if( /(.*?)$old_hostname(.*?)/i ) { $concat = "$1$new_hostname$2"; rename($_, $concat) || print "error can't renames:$!"; }