use strict; use warnings; my $conditions_txt_file = <) { chomp; next if ! length; push @conditions, [split ' ']; } close $c_card; open my $testHandle, '<', \$test_txt_file or die "Can't open data nfile: $!\n"; while (<$testHandle>) { chomp; next if ! length; my @columns = split ','; next if grep {! match ($_, @columns)} @conditions; print join (',', @columns), "\n"; } close $testHandle; sub match { my ($cond, @columns) = @_; my ($column, $test, $value) = @$cond; if ($test eq 'eq') { return if $column < 0 || $column >= @columns; my $match = $columns[$column] eq $value; return $match; } else { die "Don't know how to perform '$test' test\n"; } }