ALGORITHM: find_common INPUT: list of files (file_list) DECLARE: hash of IDs (id_hash) CALL: get_data WITH references to file_list and id_hash CALL: get_common WITH reference to id_hash #### #!/usr/bin/perl -w use strict; my $first = 0; my ($keynum, @stans, @procs, @resultBucket) = (undef, (),(),()); my $usefulRegex = qr~ID([^\:]+):(.*)$~; while (){ ++$first && next if (m/^FILE/ || (m/^\s*$/)); if ($first >= 2) { #processing the data if(m/$usefulRegex/){ $procs[$1] = $2; if ($stans[$1] ne $procs[$1]) { print qq~$1 lines are different\n~; } } } else { #storing the core for comparison if(m/$usefulRegex/){ $stans[$1] = $2; } } print; } print qq~first: $first\n~; __DATA__ FILE1 ID1:6qq5_A|14~~6qq5_B|14~~6qq6_A|14~~6qq6_B|14~~6t6v_A|14 ID2:7d5p_A|14~~7d5q_A|14 FILE2 ID1:6qq5_A|15~~6qq5_B|15~~6qq6_A|14~~6qq6_B|15~~6t6v_A|14 ID2:7d5p_A|14~~7d5q_A|12 #### perl -e '$aline = qq~foo1: fie fo fum~; my ($aid,$rec) = split /:/,$aline; $aid=~s/^[a-z]+//; print qq~$aid...$rec\n~;' 1... fie fo fum