Use -1 as the third argument of split:
$rec = 'has|trailing|pipes|||'; print(scalar(split(/\|/, $rec )), "\n"); # 3 print(scalar(split(/\|/, $rec, -1)), "\n"); # 6
In reply to Re^3: Delimeter Count?
by ikegami
in thread Delimeter Count?
by Ronnie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |