in reply to Using Files
{local($^I,@ARGV)=('.bak','file.txt'); while(<>){ #the current line is now in $_, the line in the new edited file is wha +t ever I will print now(to ARGVOUT which is already select()ed) if ($.==$linenumberiwanttochange){ chomp; #edit the line print "$_\n"; #print the edited line }else{print} #leave the other lines with no change } }
|
|---|