http://www.perlmonks.org?node_id=727883


in reply to splitting a string

Hi,

From split doc,

"Empty trailing fields, on the other hand, are produced when there is a match at the end of the string (and when LIMIT is given and is not 0), regardless of the length of the match"
.

use strict; use warnings; my $string = "/home/source::::::::DATE:SUBJECT:NAME::::::"; my @array = split(/:/,$string, -1); $" = '><'; print "<@array>\n"; print scalar(@array); output: ------- </home/source><><><><><><><><DATE><SUBJECT><NAME><><><><><><> 17

Prasad