Skip to content

Instantly share code, notes, and snippets.

@JEEN
Created December 7, 2016 00:21
Show Gist options
  • Save JEEN/fe1d9e2893c3282378266714b520ec6f to your computer and use it in GitHub Desktop.
Save JEEN/fe1d9e2893c3282378266714b520ec6f 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