in reply to Re: The best way to split tab delimited file
in thread The best way to split tab delimited file

By placing the comma in a negated character class you lose any character preceding the tab, apart from a comma, in the resultant array because it becomes part of the split term. Placing the comma in a negative zero-width look-behind, as gmargo does here, the characters are retained.

$ perl -le ' > $txt = qq{abc\tdef,\tghi\tjkl\tmno}; > print for split m{[^,]\t}, $txt; > print q{-} x 20; > print for split m{(?<!,)\t}, $txt;' ab def, gh jk mno -------------------- abc def, ghi jkl mno $

I hope this is of interest.

Cheers,

JohnGG