Help with sed - replace text

Hi,

I need to replace text in a file. Can someone help me write the proper sed command for this? My text file contains about a 100 lines of content. I want to replace the line containing

new_name = "#{options[:nickname]}-#{ENV['INSTANCE_ID']}"

by, the following -

new_name = "#{options[:nickname]}-#{ENV['INSTANCE_ID']}-#{rand(999)}"

Thanks in advance!

perl -wl -e 'while(<>){s/(new_name = "\#\{options\[\:nickname\]\}-\#\{ENV\[\'INSTANCE_ID\'\]\}-\#\{rand\(999\)\})\"/$1-\#\{rand\(999\)\}"/ and print' your_file

(untested).. LOTS OF special characters.......whoa.