How to find similar values in different files

Hello,

I have 4 files like this:

file1:

cg24163616    15    297
cg09335911    123    297
cg13515808    565    776
cg12242345    499    705
cg22905282    225    427
cg16674860    286    779
cg14251734    303    724
cg19316579    211    717
cg00612625    422    643

file2:

cg02792168    230    498
cg00272971    223    330
cg26439963    252    532
cg23206032    660    861
cg19507206    118    134
cg20641465    233    507
cg02631092    459    772
cg19018709    390    481
cg14302224    106    125
cg12421087    442    479

file 2:

cg22905282    385    475
cg08927006    93    257
cg13737332    107    257
cg17863743    34    257
cg16401360    62    257
cg09511126    100    257
cg16825290    44    503
cg13690864    13    213
cg18577511    62    213
cg25651562    193    475

file 4:

cg27449572    486    873
cg14244636    518    719
cg23078268    155    585
cg05732883    395    763
cg26712743    478    789
cg16674860    89    329
cg15996984    448    809
cg26329178    39    357
cg00612625    265    476
cg02800607    88    366

I wrote a perl script to find the id's (first columns) that occur in all 4 files (total length ~400.000 lines), and create an output file that contains that id plus the values in every file for that particular id, but this takes forever!
Is there an easy way by using for example grep?

My output would be:

id    valuefile1    valuefile2    valuefile3    valuefile4

Thanks!

awk 'END {
  for (ID in id)
    if ( count[ID] == ARGC - 1 )
      print ID, id[ID]
  }
{
  v = $2 OFS $3
  id[$1] = $1 in id ? id[$1] OFS v : v
  tmp[$1, FILENAME]++ || count[$1]++
  }' file1 file2 [...]
#! /bin/perl

for($i=0;$i<$#ARGV+1;$i++)
{
$FH="F${i}";
open($FH,"< $ARGV[${i}]") || die "couldn't open $ARGV[${i}]";
while(<$FH>){
chomp($_);
@field=split(/  */);
$count{$field[0]}++;
   if($count{$field[0]}==(${i}+1)){
       $hash{$field[0]}="$hash{$field[0]} $field[1] $field[2]";
       }
   else{
       delete $hash{$field[0]};
       }
}
close $FH;
}
foreach $key ( keys %hash){
if($count{$key}==($#ARGV+1)){
print "$key $hash{$key}\n";
}
}


Pass the arguments as below

 perl file.pl file1 file2 file3 file4