Re: trouble with substitutionby ww (Bishop)
|on Jan 19, 2012 at 03:27 UTC||Need Help??|
"the programme compalins" (sic). Yes, it certainly does. Did you try to understand the complaints?
Did you read even the very first section of the posting guidelines (How do I post a question effectively?, inter alia) which tell you'll we'll be better able to help if you tell us (inside code tags) the wording (verbatim!) of what the program says when it "compalins?"
In any case, the first message says you failed to declare $VAR1 before using it.
The second points to the fact that you've written an if clause (a "conditional") without a block of code telling the program what to do when the if returns 'true' (and preferably, also, when it returns 'false'). See "Conditionals" in perldoc perlintro (at your CLI) or perlintro (in your browser).
What you seem to be looking for is something like this:
which produces this output:
Adding the necessary code to write a new file from @newarr (or, to write the new file without resort to that extra varaible/data structure) is left as an exercise.
HOWEVER, the job sequence of which this is a part would probably be less subject to error and easier to maintain, were you to process whatever the source data that's fed into your dumpparse.txt into an appropriate data structure (which may or may not be a hash; more likely, not, from the looks of it, but you haven't told us enough to put much credence in that interpretation) and perform the remaining processing in a single script.
Updated: minor edits for brevity/clarity.