Help for this page

Select Code to Download


  1. or download this
    my $hosts = "C:/windows/system32/drivers/etc/hosts";
    
    ...
    open FILE, ">$hosts" or die "Can't write $hosts $!\n";
    print FILE "127.0.0.1 localhost\n$line";
    close FILE;
    
  2. or download this
    my $hosts = "C:/windows/system32/drivers/etc/hosts";
    
    ...
    print OUT $line;  # add the new record
    close IN;
    close OUT;
    
  3. or download this
        $old =~ s/\Q$old_ip\s+/$new_ip /;
        print OUT $old;
    
  4. or download this
    C:\>perl -pi.bak -e "s/this/that/g" <file>