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....#!/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
prog_file.lib#!/usr/bin/perl $APPNAME="AnyApp" require "prog_file.lib"; read_prog
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...sub read_prog print <<"EOF"; print "This is the var \$APPNAME and this is what needs to get substit +uted $APPNAME\n"; EOF 1;
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |