Hi all, I'm looking for some module recommendations before I run off and reinvent a wheel. This is a two-part question; for the first part I haven't really found anything on CPAN, and for the second part I have a few ideas (below), but again, haven't really found anything. I suspect there might be some modules I'm missing.

So I have two-dimensional data represented as an AoA. In a configuration file, I need to specify ranges of that data, for example "extract rows X through Y and columns M through N". It would be nice if these ranges could be expressed in some easy way, like in the example I showed below, and I would like to get only a 2-dimensional subset of the larger data. The second part is, it would be really nice if the returned values were aliases/references to the original data, so that if I make a modification to the subset, it modifies the original, and vice versa (so basically, I want a "view" of the larger dataset). I know I could do this with Data::Alias or tied arrays, but again, maybe someone knows a module that already provides this. Here is the whole thing expressed in code:

use warnings; use strict; use Test::More tests=>2; sub getsubset { ... } my $data = [ ['a','b','c','d'], ['e','f','g','h'], ['i','j','k','l'], ['m','n','o','p'] ]; my $range = 'R2C2:R3C3'; # or any other useful syntax! my $subset = getsubset($data, $range); is_deeply $subset, [ ['f','g'], ['j','k'] ]; # Part 2: $subset->[0][1] = 'X'; $subset->[1][0] = 'Y'; is_deeply $data, [ ['a','b','c','d'], ['e','f','X','h'], ['i','Y','k','l'], ['m','n','o','p'] ];

In reply to Selecting Ranges of 2-Dimensional Data by haukex

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.