The file I am reading from contain the following : c:\\tmp\\05152003.Log c:\\tmp\\d25573786-.Log c:\\tmp\\drwtsn32.log c:\\tmp\\nbenv10 c:\\tmp\\nbenv11 c:\\tmp\\nbenv12 Here a snippet of my script which I ran in the c:\ drive : use strict; use File::Find; use Sys::Hostname; my $fileupdate; my $old_hostname = "d25573786-"; my ($orig,$concat,$new_hostname,$answer); my @lines = " "; my $new_hostname = ""; ## Create new hostname based on physical address ### $new_hostname = shift; if ($new_hostname eq "" ) { $new_hostname = "css12345"; print "Current host name of machine is :$old_hostname \n"; print "The new host name is going to be: $new_hostname\n"; } if ( $old_hostname ne $new_hostname ) { &personalization; } else { print "System already personlized\n"; } chmod( 0777, $orig ); #--------------------------------------------------------------------------------------------- sub personalization { open(FH,") { if( $line =~ /(.*)$old_hostname(.*)/i ) # any files that contain the substring of the old hostname { print "file that match $line\n"; $orig = $line; $concat = $line; $concat =~ s/(.*)$old_hostname(.*)/$1$new_hostname$2/gi; #CALL UPDATE SUBROUTINE rename($orig, $concat) || print "error can't rename $orig to $concat: $!"; &modified_file($concat); } else { &modified_file($orig ); } } } #--------------------------------------------------------------------------------------------- sub modified_file { $fileupdate = shift; open (IN,"<$fileupdate"); @lines = ; close IN; my $change_count = 0; @lines = map { $change_count++ if s/$old_hostname/$new_hostname/sgi; $_ } @lines; next unless $change_count; open (OUT,">$fileupdate") || "can't open $fileupdate for writing :$! "; print OUT @lines; close OUT; }