#!/usr/bin/perl -w use strict; my $txt = 'a,b,c,d,,,,,,'; my @fld = split(/,/,$txt); print "\$txt = |$txt|\n"; print "\@fld = |@fld|\n"; for (0 .. $#fld) {print "\$fld\[", $_, "\] = |$fld[$_]|\n"}; __END__ Results: -------- $txt = |a,b,c,d,,,,,,| @fld = |a b c d| $fld[0] = |a| $fld[1] = |b| $fld[2] = |c| $fld[3] = |d|