in reply to Re: How to improve regex for parsing equals delimited data
in thread How to improve regex for parsing equals delimited data
Hmmm... I wish that the result of a pre-increment was an lvalue. That would allow this:
my %x = (field => $F[$_ - 1], value => $F[$_]);
to become this...
my %x = (field => $F[(--$_)++], value => $F[$_]);
or maybe even...
my %x = (field => $F[--$_++], value => $F[$_]);
Now that would be a fun idiom! As things stand, this works:
my %x = (field => $F[--$_], value => $F[++$_]);
That said, my initial boring version is probably more readable.
Update: I've just remembered the secret inchworm-on-a-stick operator. This is one of those rare opportunities it's actually useful:
my %x = (field => $F[~-$_], value => $F[$_]);
|
|---|