SPUG:Split question
Thane Williams
thane at fastmail.fm
Fri Mar 21 16:26:27 CST 2003
I've often found myself wishing there were an option to split a string
while retaining the characters you split with. For example:
$string = "a,b,c,d,e,f,";
@array = split /,/, $string;
print "@array\n";
Would print
a, b, c, d, e, f,
instead of
a b c d e f
Has anyone else wished this? Does anyone have any suggestions? I'd find
this particularly useful when I'm dividing up big files based on
complicated strings, and I want to preserve those strings in the chunks.
More information about the spug-list
mailing list