hen i print the line the value is changed but when i vi the file it still has the old value..any help of what's going wrong
As moritz said, you are just "reading" a file. Thats it. BUT: Perl provides a special way to modify lines of files via its command line interface. The following command would read the file line by line and change the sequence "newyork 1536000" to the desired output - which is written to a temporary file and renamed to the original file name afterwards. The original file will be kept and named test.cfg.bak (this is what the -i option does).
Unix/Linux:
perl -i.bak -pe 's/(newyork\s+)1536000/${1}7878787878/' test.cfg
Windows:
perl -i.bak -pe "s/(newyork\s+)1536000/${1}7878787878/" test.cfg
Regards
mwa