#!/usr/bin/perl use strict; # input file of ##REPORT cards my $str = do {local $/ = undef; }; # keepers my %keeplist; open (RIDS, '<', 'rids_that_have_versions.txt') or die; while () { chomp; $keeplist{$_} = 1;} my @cards; while ( $str =~ /(##.*?)(?=(##|\Z))/gs ) { my $rid = substr($1, 19, 10); print "$rid: " . ($keeplist{$rid} ? 'y' : 'n') . "\n"; }