sub trim($) { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } #### This is a line. :O and this is another line. This line is a bit more of a loner, because hes 2 lines away. #### This is a line. :O and this is another line. This line is a bit more of a loner, because hes 2 lines away. #### opendir(DIR, "."); for $file (glob("*.shtml")) { $line = ""; $file_data = ""; open(FILE, $file); my @data = ; foreach my $line (@data) { #Work to be done on each line of the file $file_data .= $line; #rebuild file } open (WRITE_FILE, ">$file"); print WRITE_FILE $file_data; close WRITE_FILE; close FILE; print "Processing... ".$file."... Done!\n"; } close DIR;