"A. Pagaltzis" <[EMAIL PROTECTED]> wrote: > John Douglas Porter <[EMAIL PROTECTED]>: > > Yes, but his example data was text in a here document. > Then add a note about the caveat.
Sorry, I thought (and still do) that the OP's caveat was understood to still be in effect. > > join "\n", @lines, $tail; > > Unfortunately, that won't work either - regardless of the > value of $tail - even undef -, you are joining an extra > element onto the string. Again, if the data came from a here doc, and the split regex is /\n/, then $tail will be exactly "" (the null string). If I were coding up a more general solution, I'd probably do something like this: my @items = split $splitter, $text, -1; push my @ignored_final, pop @items if ignorable($items[-1]); # and then: $text = join $joiner, @items, @ignored_final; where ignorable() might be defined as !length(). But clearly we're straying way off topic for this list. -- John Douglas Porter __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com