First, thanks for the responses. After posting this I did do further research and found HTML::Template. Not sure it's what I'm looking for though. The code I provided was an example of the task at hand. Basically, it's to take a perl script and treat it as a flat text file and read it in substituting the vars as needed from the perl script creator. I do have a working bash script that was very easy to make.
#!/bin/bash APPNAME="AnyApp" screen=1 if [! screen ]; then { cat > /tmp/new_prog_file << EOF } else { cat << EOF } print "This is the var \$APPNAME and this is what needs to get substit +uted $APPNAME\n"; EOF
Works a treat with little effort (max efficiency) the goal. However perl seems to be a cronic complainer. It seems from tests so far the only way to get perl to sub the vars is to make prog_files an include, then perl complains about everything in prog_files. As a note.... \$APPNAME results in $APPNAME.... $APPNAME results in AnyApp.... Bash just eats, digests and spits out the result. Simple, my favorite method KISS. Now I also tried the equiv in perl....
#!/usr/bin/perl $APPNAME="AnyApp" require "prog_file.lib"; read_prog
prog_file.lib
sub read_prog print <<"EOF"; print "This is the var \$APPNAME and this is what needs to get substit +uted $APPNAME\n"; EOF 1;
The problem is getting an "if" to print to screen or to a file to work, either from the require sub or from the perl creator prog. Easy using bash, not so with perl....at least not for me. My mind is already boggled by the var substitutions that needed to be done throughout. Solved the var boggle issue using a var naming convention. Thanks in advance...

In reply to Re^2: Perl Script to write a perl script by electroman00
in thread Perl Script to write a perl script by electroman00

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.