my ($a) = "the|sneaky|camel||"; my (@b, $nil); # Try different parameters with split and report for my $p (undef, -1) { @b = split (/\|/, $a, $p); ($nil) = pop (@b); print "split() with '$p': '$nil' should be empty, ", (length($nil)?" but isn't":"and is"),".\n"; }