If I've reverse engineered a spec from your post correctly, then something along these lines should suffice:

#!/usr/bin/env perl use strict; use warnings; use feature 'say'; my $infile = shift; open my $in, '<', $infile or die "Cannot open $infile: $!"; while (<$in>) { chomp; s/=\s*$/"= " . shift/e; say; } close $in;

Running it with your sample input gives:

$ ./bar.pl template.config list.txt file_list.txt ;; path to config file $;INPUT_FILE$; = list.txt ;; path to list of config files $;INPUT_FILE_LIST$; = file_list.txt ;; path to temporary directory $;TEMP_DIR$; = $;TMP_DIR$; ;; use --v for verbose summary $;OTHER_ARGS$; = --v

Update: removed a redundant mention of @ARGV in the substitution.

Update 2: for the avoidance of any confusion resulting from the parent post having been rewritten to change both the data set and the invocation, here's the original input file:

;; path to config file $;INPUT_FILE$; = ;; path to list of config files $;INPUT_FILE_LIST$; = ;; path to temporary directory $;TEMP_DIR$; = $;TMP_DIR$; ;; use --v for verbose summary $;OTHER_ARGS$; = --v

which was declared to be called as I have above and result in the output which I have also shown above.


In reply to Re: Read in a template file, populate using user input and and generate a new file by hippo
in thread Read in a template file, populate using user input and and generate a new file by Bioinfocoder

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.