Honestly I wouldn't have implemented it your way in order to have a higher degree of reusability and readability.

Yeah, I wrote it to be kind of compact - I want to hide it away in a pm and not worry about it anymore (hence all the the tests). My application has limited scope, definitely only 2D data (fiddling with CSV), and I'm probably going to hide it away in a class so that the implementation can be upgraded later if necessary, or maybe replaced with an existing module (hence this thread).

Though not many people know if it depends on an implementation detail.

Hm, well I found this thread by tye where it sounds like it's probably reliable, and a whole bunch of other threads where it's a suggested technique. I just tested on Perl 5.6 up to 5.28, it works fine on all of them.

And unfortunately I don't think it can be used to alias hashes (i.e. values) too.

It can :-) Also:

$ perl -wMstrict -MData::Dump -le 'my %h=("a".."j"); my $x=sub{\@_}->(@h{"c","e","g"}); $_=uc for @$x; dd \%h' { a => "b", c => "D", e => "F", g => "H", i => "j" }

In reply to Re^4: Selecting Ranges of 2-Dimensional Data by haukex
in thread 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.