Hi, yes sorry for not put all the code here, but the interesting part is on the elsif clause. Anyway, seems the best way to go through is as you advised with a for counter
Here's the whole if / else cycle i'm using for a better understanding:
foreach (@csv_out){
if($_ eq ""){
#$_ = 'NULL';
$_ = 'NULL';
print WRITEFILE "$_" . "," ;
}
elsif ($_ =~ m/[a-zA-Z]/ || ($j<10 && $j>=0)){
print "$_\n";
$_=~ s/,/ /g;
print WRITEFILE '"'."$_".'"' . "," ;
$j=$j-1;
}
else {
$_=~ s/,/ /g;
print WRITEFILE "$_" . "," ;
}
so, the first if is to match any empty field, the elsif will match the fields with characters, and the else will do all the others.
Hopefuly your advise sorted the problem.
Thanks!