in reply to using command line switches to edit file
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:while (<INFO>) { $line=<INFO>; } close INFO; my @new2; if($var{param}) { list_param($var{param}); } if($var{the}) { list_the($var{the}); }
But that might not that flexible as you need...perl -p -e 's/yourstring/yournewstring/g' inputfile > outputfile
----------------------------------- --the good, the bad and the physi-- -----------------------------------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: using command line switches to edit file
by kitty (Novice) on Feb 13, 2006 at 13:35 UTC | |
by holli (Abbot) on Feb 13, 2006 at 14:13 UTC | |
by kitty (Novice) on Feb 13, 2006 at 16:53 UTC |