## Reading the sample Value file while (<$IN>) { chomp; print $_, "\n"; my @line = split "\t"; @line = @line[@cols]; # <-- Use array slice here ...