in reply to Script to update a value in text file

in-place-edit is appropriate (YourMother's reply), but just because I'm still amazed at how cool IO::All is:
perl -MIO::All -E 's/(\d+)/$1+1/e for @{io("/tmp/amvarma.txt")}'


- Boldra