Like is a powerful word. It's a noun, verb, adjective, adverb, preposition, and conjunction. It demonstrates preferences (I like ice cream) and shows relationships (Your house is like mine). It even acts as filler when we're trying to put our thoughts in order (I was like just minding my own business when …).
Not all uses of like are equally accepted, however. One usage that has been sharply criticized is using like as a synonym for such as. Some usage commentators and English teachers command, "Use such as to mean 'for example,' and like to mean 'similar to'":
Foods such as wine and chocolate are popular choices for tasting parties.
If it walks and talks like a duck, it must be a duck.
Perhaps you learned a variation of the rule:
Don't use such as before a single example: English majors are told they can apply the skills they learn, such as writing, to almost any job they want.
Don't separate such as in a sentence: The school's banned list includes such items as mobile phones and iPods.
This rule and its variations are just nonsense.
The Same Characteristics
Certainly like means "similar to" and can show an unequal relationship: The children dread visiting their aunt because her house is like a museum: no touching allowed! But like can also show an equal relationship, "possessing the same or almost the same characteristics" and "in the same way that" as The American Heritage Dictionary (AHD) puts it.
The Cambridge Grammar of the English Language expands on that idea by classifying like as a non-scalar comparative. That is, like compares things by likeness and identity, not by degree. It's not a scale of comparison but a measure of equality.
Such as, on the other hand, is an idiom meaning "for example," says AHD. Cambridge categorizes this term, too, as non-scalar, noting that like and such as are equivalent: "Some of the more authoritarian style manuals condemn this usage, but there is no requirement that the resemblance stop short of inclusion or identity."
Which is a lot of fancy talk for "such as and like can do the same job: show an equal connection between two or more persons, places, or things."
No Confusion Here
The argument against using like for such as is that like isn't specific enough. Readers will think that the author doesn't mean that what follows like (the complement) is an instance of what precedes like. When we read the following, detractors would say, pneumonia isn't something you'd become sick with:
Weakened by hunger and cold, many became sick with diseases like pneumonia.
Would anyone really believe that in such a weakened state they wouldn't come down with pneumonia but perhaps something similar to it?
As Merriam-Webster's Dictionary of English Usage (MWDEU) points out, even when we're unclear whether the writer meant to list examples or resemblances, either meaning works in most cases, as in these examples:
... and you get more benefit reading someone like Hemingway, where there is apparently a hunger for a Catholic completeness in life.
—Flannery O'Connor (1956)
Phrases like three military personnel are irreproachable and convenient.
—Roy H. Copperund (1964)
Indeed, the difference in meaning is slight. Writes Theodore Bernstein in Miss Thistlebottom's Hobgoblins, "Such as seems to invite the reader into a category of comparable things; like makes a more direct comparison."
Are you maintaining a real distinction by choosing such as over like? Although the original wording in this example is such as, like works equally well here:
Programmers frequently solve programming problems by creating new tool programs, such as/like scripts that generate source code from tables of data.
—Communications of the ACM (2012)
Despite arguments to the contrary, both such as and like show an equivalent relationship between nouns. Use your favorite, but remember that the other isn't wrong.