Split on [ ,]+ so that split eats the spaces as well as the commas. The grep eliminates the first empty ("") element.$ perl -we ' print "--$_--\n" for grep $_, split /[ ,]+/, " c1, c2, s1, s2, c3 "; ' --c1-- --c2-- --s1-- --s2-- --c3--
In reply to Re: delete space
by keszler
in thread delete space
by zeni
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |