$ perl -wE 'my ($x, $y) = "AB" =~ /(.)(.)/; say "$x $y"' A B #### $ perl -wE 'my ($x, $y) = "AB" =~ /(.)(.)./; say "$x $y"' Use of uninitialized value $x in concatenation (.) or string at -e line 1. Use of uninitialized value $y in concatenation (.) or string at -e line 1. #### #!/usr/bin/env perl -l use strict; use warnings; use Text::CSV; use Inline::Files; my %data; my $csv = Text::CSV::->new; while (my $row = $csv->getline(\*FILE2)) { $data{$row->[0]} = [ @$row[1..$#$row] ]; } while (my $row = $csv->getline(\*FILE1)) { next unless exists $data{$row->[0]}; push @{$data{$row->[0]}}, $row->[1]; } $csv->print(\*STDOUT, [$_, @{$data{$_}}]) for sort keys %data; __FILE1__ an_en11,200.00,{0 133},{ } br_gh13,140.09,{0 59},{ } ce_oy74,300.05,{0 230},{int_43} dt_pp50,200.11,{0 122},{ } er_tk02,305.47,{0 220},{ } ef_yb41,200.05,{0 233},{ } __FILE2__ dt_pp50,0,0,2,0.000,0.000,0,0.000 er_tk02,0,2,3,0.002,0.004,0,0.001 ef_yb41,0,1,5,0.000,0.000,0,0.000 #### dt_pp50,0,0,2,0.000,0.000,0,0.000,200.11 ef_yb41,0,1,5,0.000,0.000,0,0.000,200.05 er_tk02,0,2,3,0.002,0.004,0,0.001,305.47