use strict; use warnings; my @files = qw / NC_002755.fq NC_009525.fq NC_009565.fq NC_012943.fq NC_016768.fq NC_016934.fq NC_017026.fq NC_017522.fq NC_017523.fq NC_017524.fq NC_017528.fq NC_018078.fq NC_018143.fq NC_020089.fq /; @files = map {s/\.fq$//; $_} @files; while (my $seq = ) { my @seq = split /\s+/, $seq; printf "%-50s", "@seq[0..1] "; my %found_files = map { s/\.\w+$// ; $_ => 1} grep {/NC_/} @seq[2..$#seq]; for my $file (@files) { print exists $found_files{$file} ? "1\t" : "0\t" } print "\n"; } __DATA__ (3R)-hydroxyacyl-ACP dehydratase subunit HadA NC_021192.1 (3R)-hydroxyacyl-ACP dehydratase subunit HadB NC_017026.1 (dimethylallyl)adenosine tRNA methylthiotransferase NC_009565.1 NC_002755.2 NC_009525.1 NC_016934.1 1,4-alpha-glucan branching protein NC_021192.1 NC_017522.1 NC_016934.1 NC_018078.1 NC_020089.1 NC_002755.2 NC_017524.1 NC_009565.1 NC_012943.1 NC_017523.1 NC_021740.1 1,4-dihydroxy-2-naphthoate octaprenyltransferase NC_016934.1 NC_017026.1 NC_009525.1 1,4-dihydroxy-2-naphthoyl-CoA synthase NC_018143.2 NC_009565.1 NC_002755.2 NC_012943.1 NC_017523.1