We can use such as to introduce an example or examples of something we mention. We normally use a comma before such as when we present a list of examples. Where there is just one example, we don’t need a comma:
The shop specialises in tropical fruits, such as pineapples, mangoes and papayas. (… for example, pineapples, mangoes and papayas.)
Countries such as Sweden have a long record of welcoming refugees from all over the world.
Such as is similar to like for introducing examples, but it is more formal, and is used more in writing than like:
She has worked in several countries where English is spoken as a first language, such as Australia, New Zealand, Canada and so on. (or, less formal, …likeAustralia, New Zealand, Canada and so on.)
We don’t use as on its own to introduce examples:
Young kids these days seem to love 1960s rock bands, such as the Beatles, the Kinks or the Rolling Stones.
Not: … to love 1960s rock bands, as the Beatles …
We don’t use such as when we compare things:
The group from Dublin all wore green, white or gold t-shirts, like the colours of their national flag.
Not: … such as the colours of their national flag.