my %file1_row_for; while (my $input = ){ # only grab column 2 my ( undef, $id ) = split /;/, $input; my $file1_row_for{$id} = $input; }