#!/usr/bin/perl use strict; use warnings; use Inline C =>; my $file = $ARGV[0] || 'phase1.data'; open(my $fh, '<', $file) or die "Unable to open '$file' for reading: $!"; my @word; while (<$fh>) { chomp; my ($nform, $word) = split /\t/; push @word, $word; } $file = $ARGV[1] || 'phase3.data'; open($fh, '<', $file) or die "Unable to open '$file' for reading: $!"; while (<$fh>) { my ($nform, $str1, $str2, $str3) = split /\t/; for (@word) { if (! diff('abcdefghijklmnopqrstuvwxyz', $_ . $nform)) { print "abcdefghijklmnopqrstuvwxyz\t$_\t$str1\t$str2\t$str3"; exit; } } } print "No Cigar\n"; __END__ __C__ SV *diff(char *str1, char *str2) { /* Actual code has 256 0s - truncated for post */ char exists[256] = {}; SV *ret_sv = newSVpvn("",0); /* identify all chars present in str2 */ while (*str2) { exists[(U8)*str2++] = 1; } /* Determine chars in str1 not in str2 */ for ( ; *str1 ; str1++ ) if (! exists[(U8)*str1]) sv_catpvn(ret_sv,str1,1); return ret_sv; }