I often have situations where I want to split an existing var into
2 or more sub values. I usually use some combination of ${VAR<#|%>[<#|%>]expr},
but as soon as I don't check my break-down, I screw it up.
Which was front/back? Did I match the correct re with the correct
"truncate (or match) sense" %/#....etc. I usually get it right when
I take the time to echo it to STDOUT, making the echo redundant, but
am subject to brain-o's when I don't echo it out (Murphy hides in my
brain, waiting for me to not verify things!)
I was thinking it would be so much easier and more efficient, if I
could have two features (yeah, I guess they are two separate features).
One would be the 'split' with an "expr" to split on, and a Var.
"Expr" would usually be 1 single character, but making it an
expression would make it more flexible.
Second part was the assignment to a list of variables in the place
of an array.
Currently:
a=(1 2 3)
does an array assignment. I'd like to see the ability to
specify a list of recipient vars, with the last being a "catchall"
that would become an array if there were multiple values still needing
L-value locations. I.e.:
(a b)=(1 2 3)
would assign 1 to 'a', and 'b' would become an array, with b[0]=2, b[1]=3.
Sure, I can do all these things manually with effort, but these would
simplify some common operations.
I suppose I'm presuming these features are not already implemented in
some fashion -- did I overlook them, or would they be 'new'?
If they are new, do they look useful enough to consider?
Thanks!
Linda