in reply to Can't figure out how to include LAST member of the array
G'day perlynewby,
"IS there a Perl library that I can use for that??"
List::MoreUtils has a zip (aka mesh) function which you could use something like this:
$ perl -e ' use strict; use warnings; use List::MoreUtils "zip"; my @sorted = 1..5; my @M = map "M$_", @sorted; my @v = map "v$_", @sorted[0..$#sorted-1]; print join "->", grep defined, zip @M, @v; ' M1->v1->M2->v2->M3->v3->M4->v4->M5
— Ken
|
|---|