in reply to Matching Values in an Array

Self-contained example (not reading from files). You could store your table in a hash-of-hashes structure to make access simpler.
use warnings; use strict; my %param; while (<DATA>) { chomp; my @cols = split /,/; next if $cols[0] =~ /\D/; for my $i (0 .. 5) { $param{$cols[0]}{s}{$i+10} = $cols[$i+1]; $param{$cols[0]}{t}{$i+10} = $cols[$i+7]; } } my @stats = split /\n/, <<EOF; Station,Code 1,10 2,11 3,12 4,13 5,14 EOF for (@stats) { chomp; my ($stat, $code) = split /,/; next if $stat =~ /\D/; print "$stat $param{$stat}{s}{$code} $param{$stat}{t}{$code}\n"; + } __DATA__ Station,S_10,S_11,S_12,S_13,S_14,S_15,T_10,T_11,T_12,T_13,T_14,T_15 1,31,29,29,31,29,29,15,14,23,15,14,23 2,33,28,23,33,28,23,17,15,23,17,15,23 3,23,27,33,23,27,33,18,16,23,18,16,23 4,25,26,28,25,26,28,23,14,15,23,14,15 5,26,26,27,26,26,27,23,18,17,23,18,17 6,27,33,31,27,33,31,14,17,18,14,17,18 7,33,29,29,33,29,29,12,18,23,12,18,23

Outputs:

1 31 15 2 28 15 3 33 23 4 25 23 5 26 18