in reply to searching an array member in file header and print a column

G'day shalgham,

Welcome to the monastery.

A representative example of both your array and file would help comprehension.

It sounds like you'll want to create a hash from your array, e.g.

my %hash = map { $_ => 1 } @array;

Then process your file based on the hash, e.g.

while (<$filehandle>) { my @row_elements = split /$pattern/; next unless $hash{$row_elements[$i]}; # Process "wanted" row here }

With more information to work with, I probably could have provided a better answer. See the guidelines in "How do I post a question effectively?": a better question gets a better answer.

-- Ken

Replies are listed 'Best First'.
Re^2: searching an array member in file header and print a column
by shalgham (Initiate) on May 27, 2014 at 13:17 UTC
    Thanks Ken, I updated my question, I will check how to question soon. Thanks again