ok, now, I am stuck here. I spend time testing/reading on split with various delimiters.I learned how to remove stuff I don't want...
BUT
now I get some error I DON"T understand after 1.5 weeks of playing with perl. I'm so FRUSTRATED with my prgress!
can you help me out by explaining my error. I am too inexperience to SEE it myself.
first data key has random values of 2 or less numbers
uno = uno,eins
due = dos,zwei
tre = tres,drei
quattro = quatro
cinque = cinco,funf
sei = seis,
sette = siete,sechs
otto = ocho
nouve = nueve, neun
dieci = diez, zehn
undici = once, elf
dodici = doce
tredici = trece, dreizehn
2nd data may have 3 or less vaules
due =deux, two,
tre = trois,drei, three
quattro = quatre,four
cinque = cinq,funf, five
sei = six , six
sette = sept , seven ,sechs
dieci =dix
undici = onze,eleven
tredici = treize,thirteen, dreizehn
use strict;
use warnings;
#declare variables
my %hash;
my $data;
#opening Files
open my $in, '<',"./Test_Data_RanNumbers.txt" or die ("can't open the
+file:$!\n");
open my $in1,'<',"./Test_Data_More_RanNumbers.txt" or die ("can't open
+ file : $!\n");
open my $out ,'>' ,"./Test_Data_Out_Ita_SpanFrenEngGer.txt" or die "ca
+n't open the file for write:$!\n";
open my $out1,'>',"./Test_data_out_Ita_SpanFren.txt" or die "can't ope
+n the file :$!\n";
open my $out2,'>' , "./Test_Data_Out_None_Match.txt" or die "can't ope
+n file for write:$!\n";
while ($in){
#data manipulation to clean up ='s and ,'s
#dieci = diez, zehn -->worse case, remove spaces and = and comm
+a;
#quattro = quatro -->only one number with spaces or not in from of
+ =...
chomp($data);
my ($ita,$spa,$num)= split(/[=\s,]+/,$data); # removes '=' or 's'
+or ',' & '+' to match 1 or more these characters
$hash{$ita}[0]=$spa;
$hash{$ita}[1]=$num; #keeping it for check later if "defined" | wi
+ll be undef if not
}
close $in;
while ($in1){
chomp($data);
my ($ita,$fren,$num)= split(/[=\s,]+/,$data);
$hash{$ita}[0]=$fren;
$hash{$ita}[1]=$num; #keeping for check later checks programming
}
close $in1;
foreach my $ita (keys %hash){
if($hash{$ita}[0] and $hash{$ita}[1]){
print "$ita =>", join(',',@{$hash{$ita}}),"\n";
}else {
print "$ita =>",join(',',@{$hash{$ita}}),"\n";
}
}