use strict; my $string = "a,b,c,,d,e,,f"; my @array = grep { $_ } split ",", $string; print join ":", @array;