#!/usr/local/bin/perl5 -w $filelist = "tablecontents.htm"; $newfile = "$filelist"."htm"."new"; open(IN, " $filelist"); open (OUT, " $newfile"); while() { $line = $_; #matches no matter how many ../s for a substitution if($line =~ m/(/; print "$line\n"; } }