#!/uva/bin/perl5 -w opendir( CURRENTDIR, "." ) or die "Can't read current directory.\n"; @allfiles = readdir( CURRENTDIR ); closedir( CURRENTDIR ); foreach $file ( @allfiles ) { if ( $file =~ /\.html/ ) { push( @htmlarray, $file ); } } $arraylength = @htmlarray; for( $i = 0; $i < $arraylength; $i++ ) { open( OPENFILE, "$htmlarray[$i]" ); open( OUTFILE, ">outfile" ); while ( ) { # $_ =~ s///; # $_ =~ s/<\/a>[0-9]+<\/sup>/<\/a>/; $_ =~ s/marj\@msi\.com/mtiefert\@mindspring\.com/g; print OUTFILE $_; } close( OPENFILE ); close( OUTFILE ); rename( "outfile", "$htmlarray[$i]" ); }