One way is to take advantage of excel's ability to open tab delimited text files with .xls extension
#!perl
use strict;
open OUT,">test.xls" or die "$!";
while (<DATA>){
s/;;/\t/g;
print OUT;
}
close OUT;
__DATA__
abd;;sasa;;trre,dsa;;sdas;;dsss
abd;;sasa;;trre,dsa;;sdas;;dsss
abd;;sasa;;trre,dsa;;sdas;;dsss
I would change the other routine, but anyway, a simple solution would be double quote all the fields regardless.
#!perl
use strict;
open OUT,">test.csv" or die "$!";
while (<DATA>){
chomp;
s/;;/","/g;
print OUT '"'.$_.'"'."\n";
}
close OUT;
__DATA__
abd;;sasa;;trre,dsa;;sdas;;dsss
abd;;sasa;;trre,dsa;;sdas;;dsss