Hmm, don't really understand what you are doing there, but:
while (<INFO>)
{
$line=<INFO>;
}
close INFO;
my @new2;
if($var{param}) { list_param($var{param}); }
if($var{the}) { list_the($var{the}); }
You read in the whole file, and do nothing, but overwrite your $line. After theat you call yout sub's with the $line, which now contains only the last line of your inputfile.
Maybe you should try to put the sub-calls into the while loop!?
And if you want to replace everytime the same, than this maybe will work to:
perl -p -e 's/yourstring/yournewstring/g' inputfile > outputfile
But that might not that flexible as you need...
-----------------------------------
--the good, the bad and the physi--
-----------------------------------
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.