#!/bin/perl # removes netlib.org from links use warnings; use diagnostics; use strict; use File::Find; use File::Copy; my $dir = '/home/netlib/misc'; my $file = 'gams.html'; find (\&Wanted, $dir); sub Wanted { unless (-d) { if ($_ eq $file) { print "\nFile: $File::Find::name\n"; copy("$File::Find::name", "$File::Find::name.bak"); open FILE, "$File::Find::name" or die "Can't open/find $File::Find::name to read: $!\n"; my @lines = ; close FILE; open FILE, ">$File::Find::name" or die "Can't open $File::Find::name to edit: $!\n"; foreach (@lines) { s/http:\/\/www\.netlib\.org/http:\/\/netlib3\.cs\.utk\.edu/g; print FILE; } close FILE; } } } .