in reply to Extracting common keys present in multiple files

Show us what you have tried and we'll help you sort out the problem areas. It helps us a lot to help you if you provide a small test script we can run without having to mock up your test environment. See I know what I mean. Why don't you? for tips on how to generate any files you might need for the test script.

Note that to test your solution you can probably get away with a couple of short files and only require 2 (instead of 25) "matches among all of them".

Premature optimization is the root of all job security
  • Comment on Re: Extracting common keys present in multiple files

Replies are listed 'Best First'.
Re^2: Extracting common keys present in multiple files
by Anonymous Monk on Oct 27, 2015 at 03:31 UTC

    This is what I have so far, I know it is a mess. I'm not quite sure if this was the best way to incorporate the test files, but I put them at the bottom under DATA.

    #!/usr/bin/env perl use strict; use warnings; my @files = shift foreach my $file (@files) { open my $fh, '<', $file or die "Couldn't read '$file': $!"; while (<$fh>) { my %names; my $name ; my $number; $name = $1; $name = split(',', $files); }; __DATA1___ A12345,23 A22334,100 A22789,44 A10923,89 __DATA2___ A89224,88 A12345,99 A78663,100 A10923,89 Expected output: given 2 matches present and at least one in each file A10923 A12345