Cook pasta in boiling salted water until al dente. Meanwhile, heat oil in a large frying pan, add onions and cook over medium heat for 3 minutes or until soft, then add garlic and anchovies and cook, stirring occasionally, for another 3 minutes or until anchovies dissolve. Sprinkle over sugar, add sultanas and vinegar, stir and cook for 2 minutes or until sultanas are plump. Add broccoli rabe and pinenuts, then cook for 3 minutes or until rabe wilts.
Drain cooked pasta, then add to broccoli rabe in pan and cook, stirring, for 2 minutes or until well combined. Season to taste with salt and black pepper and serve immediately, with pecorino passed separately, if using.