in reply to replace field

Your algorithm won't work because:

Replies are listed 'Best First'.
Re^2: replace field
by Anonymous Monk on Jul 31, 2009 at 13:21 UTC
    I tried to do +> but it seems to empty the file. About $val+1, according to the program logic the digit there will always be single digit, so there is no problem of additional bit. So the only problem now, is to open the file and grep a key and then replace the 2nd field. So anything else I can do now...?

      Maybe you could use Tie::File ? You can process the file as an array and modify the lines in place using ikegami's suggestion.
      HTH!

      Just a something something...
      > means CLOBBER the file (ie delete, recreate)