Anyway, eval is so very rarely needed and should be shunned. But you wanted minor corrections. Let's see...
Change
toif ((eval "$cells[$extract_col] $filter_array[$i][1] $filter_array[$i] +[2]"))
if ((eval '$cells[$extract_col] ' . $filter_array[$i][1] . ' $filter_a +rray[$i][2]'))
I need to print the entire row of the input file to the output file
Then why don't you do so? Change
print OUTFILE "$cells[$extract_col]", "\n";
to
print OUTFILE $row, "\n";
The clarity of your code would be somewhat enhanced if you gave @filter_array's columns names; e.g. $filter_array[$i]->{action} = 'append' or $filter_array[$i]->{column} = 'c'. Remember: with clear code, it is easier to be certain that it works correct.
Oh, and please stop quoting "$var" since it is identical to plain $var -- barring a few exceptions having to do with references and objects.
In reply to Re^2: match search string with column header, do some filtering with matched column, print lines/rows that match filter criteria
by Anonymous Monk
in thread match search string with column header, do some filtering with matched column, print lines/rows that match filter criteria
by dkhalfe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |