Edit a line in a file with perl

Hi,
How can I edit a line in a file?

For example, a.txt contains:
start: 1 2 3 4
stop: a b c d

and I want to change "3" to "9"

and to add "5" after "4"

the result should be (a.txt):
start: 1 9 3 4 5
stop: a b c d

Thanks,
zed

I didn't mention this but it need to be in a perl script.

Thanks,
Zed

perl -i.bak -p -e 's/^(start:) (1 2 3 4)/$1 1 2 9 4 5/' a.txt

Thanks for the reply,
but my problem is that I don't know the value in advance.
I need to read them and according to their values to change them.

Thanks.

If you replace 3 with 9, how do you get 19345. Should it not be 12945 ?

Also, what is the logic ? Would all 3's get replaced by 9 ? Would a 5 follow 4 always ?

sed -e "/start/{
s/ 3 / 9 /g;s/ 4 [^5]/ 4 5 /g"
}" input.txt

fpmurphy has shown you how you can edit a file with a perl command line one-liner, now you need to supply the logic to figure out what you need to do. Since we can only go by the one sample you provided that is all we can really help you with. So if you want more help you will need to supply more information about what you are trying to do. And please post any code you have written up to now.