I installed active perl same version on windows XP and windows 7.
I have found that on windows XP and ubuntu split will return empty array elements, but on windows 7 it won’t. For example:
my @array;
my $item = "test,,,,";
@array = split(/,/,$item);
print $#array;
will print 4 and the array will have 3 empty elements, but on windows 7 it always prints 0 and has only 1 element. Does anyone know why this happens and what I should be using to make the perl script more portable?
According to the documentation of
splitthe Windows 7 version is correct:So if you split e.g.
",,,test,,,,"then your example should print3. (Tested with 5.10.1 on Ubuntu 10.04.)