No, I don't know anything about perl. I know a bit about some other programming languages, but perl seems a little overwhelming. So many modules!
Anyway, on to my problem. I want to write a bit of code that takes a template HTML file and sticks a bit of text from a text file in at a given location. I've been trying to use HTML::template - I've managed to sub variables but I'm having trouble doing files.
I gave up on HTML::template for a while and tried to read each file into a looong scalar and do a search/replace:
template =~ s/TEXTGOESHERE/$textfile/se
I had no luck with either of these, probably due to my total lack of perl-fu. ("Snatch the pebble from your hand master? What pebble?")
If that werent enough, theres more. I have two web servers to work with - one has every perl module known to man, and i use it to test my scripts. Unfortunately the 'production' server has absolutely nothing but barebones perl, and I don't relish the task of convincing the admin to install any modules - the more I ask for the longer it will take (months+) so a solution that uses as few modules as possible would be most appreciated, although anything at all would still be great. Thanks!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.