There must be something else the issue here, as if you remove all of the trailing tabs from the string, it works fine on all versions of perl I have installed currently.
Works:
use warnings; use strict; my $value = "A\tB\tC\tD\tE\tF"; my @flds = split(/\t/, $value); $flds[16] = undef; $flds[8] = 0; print scalar @flds; __END__ 17
Broken:
use warnings; use strict; my $value = "A\tB\tC\tD\tE\tF\t\t\t\t\t\t"; my @flds = split(/\t/, $value); $flds[16] = undef; $flds[8] = 0;
In reply to Re^2: split problem
by stevieb
in thread split problem
by rmarkman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |