open (FILE, $filename); while(){ # walk each file my $line = $_ ; chomp $line; #grabbing and printing everything between the body tags if (//i ... /<\/body.*?>/i){ # this is a body line # extract the body ##########################3 ###### this is where i need to put an if else statement that does nothing if http:// and .html are found in the same line ##Changing .html to .asp at the end of every link that do not belong to an external link s/(href=.+?\.)html/$1asp/gi; $body_temp = $_; $body_temp =~ s/(.*?)\(.*?)\<\/body\>/$2/i; chomp($body_temp); $body = "$body_temp" ; # Write the body to the output file print OUTFILE $body . "\n"; } } close(FILE);