#!/usr/bin/perl use strict; my @list = glob("/home/onyx2/www/*.shtml"); foreach my $file (@list) { open FILE, "$file" or die "open: $!"; for () { $_ =~ s%foo\-fuu\.net%fuuonline\.com%ig; print FILE $_; } close FILE; }