mt2k has asked for the wisdom of the Perl Monks concerning the following question:
$str = "hello=this=is=a=nice=sentence=with=many=equation=signs";
I wish to split this string up into an array on every second occurence of the '=' sign. Therefore, the structure I wish for is this:
@splitted = ( 'hello=this', 'is=a', 'nice=sentence', 'with=many', 'equ +ation=signs' );
My problem is I wonder whether it is possible to do so using the split() command or whether a regex is required to accomplish this task.
Thanks for the help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: Splitting on Every Second Occurence
by jeffa (Bishop) on May 04, 2002 at 19:59 UTC | |
|
Re: Splitting on Every Second Occurence
by Kanji (Parson) on May 04, 2002 at 20:09 UTC | |
|
Re: Splitting on Every Second Occurence
by belg4mit (Prior) on May 04, 2002 at 21:04 UTC |