in reply to subset extraction from master file

Something like this should do it
open(my $master_fh => "master.file") or die "ack: $!"; open(my $subset_fh => "subset.file") or die "ack: $!"; my %subset = map { chomp; split ':', $_, 2 } <$subset_fh>; open(my $result_fh => ">", "result.file") or die "ack: $!"; while(<$master_fh>) { my($key, $rest) = split ':', $_, 2; print {$result_fh} join ':', $key, $subset{$key}, $rest if exists $subset{$key}; }
While not suitable for large subset files, this should create a new file with the subset and its related contents from the master file in a colon seperated list.
HTH

_________
broquaint