in reply to Merging Files Conundrum: A Better Explanation(?)

ok, hopefully nobody will shot at me for this huge piece of code, but the following is something we were using for such kind o stuff.
#!/usr/bin/perl -w use strict; $|++; my (@DBFile, %DATA, $file, $name); $DBFile[0] = "../path/file_A.txt"; $DBFile[1] = "../path/file_B.txt"; my $output = "../path/file_C.txt"; ReadAllData(); print "\n".$DATA{'A'}{'C1'}{0}; print "\n".$DATA{'A'}{'C1'}{1}; print "\n".$DATA{'A'}{'C1'}{2}; print "\n".$DATA{'B'}{'CA'}{0}; print "\n".$DATA{'B'}{'CA'}{1}; print "\n".$DATA{'B'}{'CA'}{2}; ###### ## SUB ReadAllData shall ## read all files specifies in the array @DBFile ## sub ReadAllData { my ( $i, $file); $i = 0; foreach $file (@DBFile) { &me_read_CSVDB($file,$i); $i++; } return $i; } ## ## END SUB ReadAllData ###### ###### ## SUB me_read_CSVDB shall ## READ specified FILE_DATA_BASE ## ## into a large hash ## sub me_read_CSVDB { my ($tmp, $name, $num, $i, $j, $line, %keyfields); $name = $_[0]; $num = $_[1]; my $FILE_DATA_BASE = $name; $name =~ s/(\.txt$)//i; $name =~ s/^\..*?\_//i; $i = 0; $line = ""; open CURRENT_DB, "<$FILE_DATA_BASE" or die "Couldn't open file $FI +LE_DATA_BASE: $!"; my @keyfields = split(/[;]/, <CURRENT_DB>); ## EXTRACT KEYFIELDS # +# while ($tmp = $keyfields[$i]){ $keyfields{"$name"}{$i} = $tmp; $i++; } my $numofkeys = @keyfields; ## EXTRACT VALUEFIELDS FOR EACH RECORD +SET ## $tmp = $keyfields{"$name"}{($numofkeys-1)}; chomp $tmp; $keyfields{"$name"}{($numofkeys-1)} = $tmp; $i = 0; while ($line = <CURRENT_DB>){ chop $line; my @valuefields = split(/[;]/, $line); if (length($line) != 0){ for ($j = 0; $j < $numofkeys; $j++) { $DATA{"$name"}{($keyfields{$name}{$j})}{$i} = $valuefi +elds[$j]; } } $i++; } close CURRENT_DB; ## END OF READING DATA_BASE ## return $i; } ## ## END OF SUB me_read_CSVDB ## ##############################
so what it does? it is reading the specified files and enables you to access your data by the name of the row in your file.

the files look for now as follows. Play around with that and see for yourself.
But anyway, all suggestions for improvement are very welcome :-)
"../path/file_A.txt" ID;C1;C2;C3;C4 1;one;clown;funny;children 2;two;hero;truly;saga 3;three;monk;honest;perl "../path/file_B.txt" ID;CA;CB;CC;CD 1;one;baby;scream;teddy 2;two;mom;work;book 3;three;daddy;football;PC

have a nice try :-) update: just orthography