open (FILE," $htmlfile") || die "Cannot open HTML file for parsing!: $!\n"; while() { $content="$content$_\n"; } close(FILE); #### while() { $content .= "$_\n"; } #### { local $/; # undefs $/ for this block of code only open (FILE," $htmlfile") || die "Cannot open HTML file for parsing!: $!\n"; $content = ; # reads in whole file $content =~ s/\n/\n\n/g; # if really necessary to duplicate newlines close(FILE); }