in reply to map a list
Here is one way to do what I think you want to do:
See how the code makes the map block a comfortable place, with named lexicals for the parts we work with. The nested ?: can then be written strightforward.@result = map { my ( $x, $y) = split /=#?/; /=#/ ? ( $x, fn( $y)) : /=/ ? ( $x, $y) : ( $x, fn( $x)); } split /,/, $string;
I think an approach more along the lines of dragonchild's (though he solved different problem) would be more readable and maintainable.
Anno
Update: Corrected misattribution to imp
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: map a list
by evil_otto (Novice) on Mar 12, 2007 at 22:51 UTC |