It does, but that's not the normal usage of split, either. You're saying that you've got a series of records separated by param=anything and that, in addition to returning the things that are separated by that, you also want to return the part in the parentheses.
You can use the =~ operator to apply a regex to a string (which was what I showed you in my example). That is the straightforward way to do what you want. If you have a list or array of strings to apply, you can use map or foreach to set $_ to each of them in turn, and then you don't need the =~ operator, because a regex applies to $_ by default.
Caution: Contents may have been coded under pressure.
| [reply] [d/l] [select] |
I was trying to clarify the confusion I had (that I just assumed that 'grep' works the same way 'split' does). My script now works with the 'map {/re(gex)/; $1} @list' or 'map {/re(gex)/ ? $1 : (); } @list' solution.
I will try the regex =~ thing also. This may be faster.
Thank you very much.
| [reply] [d/l] [select] |