in reply to Re: Splitting and maintaining the delimiter
in thread Splitting and maintaining the delimiter

It's not so much that I need to join the lines back together... What I've got is a sizable tagged data file. What I need to do is split them up by the tags, then get the character count of the data, including the tags. I was just curious if there was a better or more efficient way to do it. I thought about trying to do something with seek, but I believe that would involve taking two passes at the data to do so. I'll probably just go with something like:

my $delim = ':TAG:'; my @data = split $delim, $line; @data = map{ $_ = $delim . $_ } @data; print length($_) . "\n" foreach @data;

Thanks,
Rich36

UPDATE: See Molt's update on the previous post. Works great...