my $C='((w)hite|(b)lack)'; open F, $file; my ($c) = grep /$C\s+"princepawn"/i, ; #### [ 'Black', undef, 'B' ]; ### or [ 'Black', 'W', undef ];