perl -wl my ($x, $y, $z) = map defined $_ ? $_ : '', (split(',', 'a,0,b'))[0..2]; print "$x $y $z"; __END__ a 0 b