G'day rodinski,

Here's a possible solution. It doesn't require loading any modules. In the spirit of an idiom, I've greatly simplified the data: now you can see more idiom, less geography.

#!/usr/bin/env perl use strict; use warnings; my @posts = qw{a b c d}; my %fence = ( $posts[0], (map { $_ => $_ } @posts[1..$#posts-1]), $posts[-1] ); print "$_ to $fence{$_}\n" for @posts[0..$#posts-1]; my @extra = qw{w x y z}; my %info; $info{$posts[$_]}{extra} = $extra[$_] for 0..$#posts; print "$_~$info{$_}{extra}\n" for @posts;

Output:

a to b b to c c to d a~w b~x c~y d~z

— Ken


In reply to Re: Fence vs. Posts by kcott
in thread Fence vs. Posts by rodinski

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.