The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Text::LTSV - Labeled Tab Separated Value manipulator


  use Text::LTSV;
  my $p = Text::LTSV->new;
  my $hash = $p->parse_line("hoge:foo\tbar:baz\n");
  is $hash->{hoge}, 'foo';
  is $hash->{bar},  'baz';

  my $data = $p->parse_file('./t/test.ltsv'); # or parse_file_utf8
  is $data->[0]->{hoge}, 'foo';
  is $data->[0]->{bar}, 'baz';

  # Iterator interface
  my $it = $p->parse_file_iter('./t/test.ltsv'); # or parse_file_iter_utf8
  while ($it->has_next) {
      my $hash = $it->next;

  # Only want certain fields?
  my $p = Text::LTSV->new;

  # Vise versa
  my $p = Text::LTSV->new;

  my $ltsv = Text::LTSV->new(
    hoge => 'foo',
    bar  => 'baz',
  is $ltsv->to_s, "hoge:foo\tbar:baz";


Labeled Tab-separated Values (LTSV) format is a variant of Tab-separated Values (TSV). Each record in a LTSV file is represented as a single line. Each field is separated by TAB and has a label and a value. The label and the value have been separated by ':'.


This format is useful for log files, especially HTTP access_log.

This module provides a simple way to process LTSV-based string and files, which converts Key-Value pair(s) of LTSV to Perl's hash reference(s).


Naoya Ito <>


This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.