in reply to Re: Perl split on regex match
in thread Perl split on regex match

Hi Athanasius

Maybe nitpicking, but the OP said

> > I want to print a line in which third field in the element is empty

and not "less than 3 elements" (though he might have meant it)

And it may be possible to split "a.b.c..e" where the 3rd element is empty.

If this is a legal edge case I'd rather prefer unless length $cols[2]; over if @third < 3;

(N.B. length undef and length "" are both false)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!