diff --git a/tests/data/empty/cmd_and_expected_output b/tests/data/empty/cmd_and_expected_output new file mode 100644 index 0000000..c2fe95a --- /dev/null +++ b/tests/data/empty/cmd_and_expected_output @@ -0,0 +1,4 @@ +$ cat $TEST_DIR/empty.tsv | $TSV2TABLE +a | b | c + | | +A | B | C diff --git a/tests/data/empty/empty.tsv b/tests/data/empty/empty.tsv new file mode 100644 index 0000000..1aadfd0 --- /dev/null +++ b/tests/data/empty/empty.tsv @@ -0,0 +1,3 @@ +a b c + +A B C diff --git a/tsv2table b/tsv2table index 0780875..ed0f691 100755 --- a/tsv2table +++ b/tsv2table @@ -75,7 +75,7 @@ sub main { while (<>) { chomp; s/\r\z//; - my @row = split $options->{separator}, $_; + my @row = split $options->{separator}, $_, -1; for (my $i = 0; $i < scalar @row; $i++) { if (length($row[$i]) > ($max_column_length[$i] // 0)) {