Skip to content

Instantly share code, notes, and snippets.

@wyim-pgl
Forked from JEEN/map3.pl
Created May 4, 2017 22:04
Show Gist options
  • Save wyim-pgl/1bee532764784527199b0ae9e25bf35c to your computer and use it in GitHub Desktop.
Save wyim-pgl/1bee532764784527199b0ae9e25bf35c to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Text::CSV_XS;
use Data::Printer;
my $csv = Text::CSV_XS->new({ binary => 1, sep_char => "\t" });
open my $fh, "<", $ARGV[0] or die $!;
open my $fh2, "<", $ARGV[1] or die $!;
# 1. 키맵 생성
my %map = ();
while(my $row = $csv->getline($fh)) {
$map{$row->[0]} = $row->[1];
}
my $count = 0;
while(my $row = $csv->getline($fh2)) {
$row->[0] = $map{$row->[0]} ? $map{$row->[0]} : $row->[0];
print join("\t", @{ $row })."\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment