Memoize

BasicWerk   EC Support   Technique   Facebook  

20141120220846_Perl_tsv_to_YAML

Perl_tsv_to_YAML

 

 

toYAML.pl
 
#! /usr/bin/perl
use warnings;
use strict;
use YAML;
 
my %out;
while (<>){
    my ($key, @rest) = split;
    $out{$key} = \@rest;
}
print Dump(\%out);
 
 

 

 
% cat sample.tsv
aaa	yyy	30
bbb	jjj	70
ccc	k	89
 
% toYAML.pl sample.tsv              
---
aaa:
  - yyy
  - 30
bbb:
  - jjj
  - 70
ccc:
  - k
  - 89
 

 


© Shin Nakamura/BasicWerk 2014