in reply to inserting HTML file in a PERL script
On a contrarian note, thetallblondguy, the time it has taken you to consider the partial solutions in this thread, and the different ways you could indicate variables, might have been better spent looking into a full-grown "real world" application like Template Toolkit (or any of the legion of its kin). Because if this is any kind of serious work, this is not the kind of wheel you want to re-invent.
Your clarification actually suggests your question is not really a perl or CGI question, but a question about how to *surgically* separate the Perl from HTML without breaking either one. That's exactly what templating systems are designed to do.
Sure, you could create perl subroutines that spit out HTML, or separate files with some (special syntax) in them, but the list of wheels you would have to re-invent to get it right are too numerous to list here. For example:
How to disambiguate 'true variables' from 'false variables'? $19.95USD -> not a variable, a price $e1p_zE@z -> not a variable, a suggested user-password Micro$oft -> not a variable, a common company name $$$CASH$$$ -> not a variable, a common spam subject line How to handle common scenarios that always come up? # A variable whose value is contingent on another variable # A variable that appears inside of a loop # A variable that should have some 'default' fill in value if the user +-supplied value is left blank # A sample code-snippet that should appear inside the HTML and not be +messed with or interpolated AT ALL
There is a whole catalogue of issues to deal with, and each issue you resolve (on your own) means yet one more (undocumented) 're-invented wheel' that the person who comes after you will have to learn just to figure out what is going on.
If you *really* insist on creating your own system from scratch, you should at least try to use a totally unique syntax for indicating the presence of a 'true variable' ... something that is not likely to appear in any other context.
Hello @@@:username:@@@, Please consider using @@@:existing_template_system:@@@ instead of creating your own from scratch; instead of hand-rolling the @@@:huge_number:@@@th ad-hoc system that no one understands except you.