in reply to Re: Get HTML source code
in thread Get HTML source code

Actually ... i think i like this one better:

use strict; use warnings; use CGI qw(:standard); my $html = do {local $/;<DATA>}; my $mime = param('view_source') ? 'plain' : 'html'; print header("text/$mime"), $html; __DATA__ <html> <head> <title>view source example</title> </head> <body> <h1>view source example</h1> <a href="?view_source=1">view source</a> </body> </html>
Let the browser handle the data as a plain text file, instead of having to escape HTML tags and wrap the results in pre tags.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)