print "Please enter the ip address for this machine. This will be eth0:\n"; my $ip = <>; chomp $ip; my $if0 = "ifcfg-eth0"; my $if1 = "ifcfg-eth1"; my $ifdir = 'network-scripts'; my $ifsub1 = "IPADDR="; my $ifsub2 = "BOOTPROTO="; my $ifsub3 = "none"; open (IP, "<", "$dir/$sys/$ifdir/$if0"); open (NEW, ">", "$dir/$sys/$ifdir/$if0.new"); while (){ s/^$ifsub2.*/$ifsub2$ifsub3/; s/^$ifsub1.*/$ifsub1$ip/ || print "$ifsub1$ip\n"; print $_; #print "$ifsub1$ip\n"; <==I tried it here too } close IP; close NEW;