my @file = ; my $reg = s/[^,]*\.(\S*)//; while (my $line = ){ chomp $line; my $wholefile = $line.$_ foreach(@file); print OUTFILE $wholefile; }