Your goal should be to do what you enjoy - and literally refuse to do what you do not (assuming we're talking about productive Perl hacking). If you do it right, you will be untouchable and they will bend. And always have a back up plan if one day you are not as untouchable as you thought. The world has changed over night and now many places are going to stick with remote work. So know what's out there and what your real options are.
>I fear I'll lose my job
Shake that fear, friend. Don't let it have any power over you. Look what's it's doing to your health. You'd be happier living on the street migraine free and jobless. I assure you.