$line = "s1:a,first,b, second, c,third"; $line =~ s/ //g; #print $line;