in reply to printing every 2nd entry in a list backwards
Also a common trick for a flip flop boolean state is inversion with xor $i^=1print map {$i++ & 1 ? "" : "$_ "} reverse split(/ /);
$,=" "; print grep { $i^=1 } reverse split(/ /);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: printing every 2nd entry in a list backwards
by Anonymous Monk on May 19, 2017 at 14:17 UTC | |
|
Re^2: printing every 2nd entry in a list backwards
by Anonymous Monk on May 19, 2017 at 14:01 UTC |