$hostname ="testing";#it may be ip address or remote host name $hostfilename="temp\fooo.ini"; $hostfilename =~ s/\\/\\\\/g; my $file="\\\\$hostname\\$hostfilename"; if(!-f $remotepath){ print "Remote access and add content to remote file\t\Failed"; exit; } else{ #Remote file access open(TEMP,">>$file") or die ("cannot open the remote file '$file':$!"); #Here add your stuff to append data to the remote file close(TEMP); }