Please don't use $a or $b as variable names -- NOT EVEN IN EXAMPLES; they have specialized behaviors for use when sorting... and they don't provide any indication of their content. Some short (1 letter) possibilities: $s (for "string"); $l for line; etc. etc.
P.S: syntacticly trivial, but annoying: You changed the character you wanted removed from a comma in your OP to a single quote in your 'simplest answer.' Perhaps one was a typo, and in this thread, probably just set off my pre-coffee compulsiveness/ill-humor/whatever... but like $a, it sets a bad example for future readers.
If I've misconstrued your question or the logic needed to answer it, I offer my apologies to all those electrons which were inconvenienced by the creation of this post.