in reply to cool regular expression needed for matching in columns

Using unpack and a hash instead of regex could be cool too:
use strict; my %pat = ( abc => 1, xyz => 1 ); while (<DATA>) { my $out = ''; for my $seg ( unpack( 'A3A3A3', $_ )) { $out .= "$seg " if ( $pat{$seg} ); } print "$.: $out\n" if ( $out ); } __DATA__ abcmmmnnn mmmxyznnn mabcmxyzm xyzabcmmm abcmxyznn