I checked CPAN, and it seemed like there were no Tie:: modules that cover this niche (BTW, it's interesting how many different Tie::* modules there are), so I just released Tie-Subset. My code from here now has two more working implementations:

use Tie::Subset::Array; sub arr_alias_4 { my ($arr,@i) = @_; tie my @x, 'Tie::Subset::Array', $arr, \@i; return \@x; } use Tie::Subset::Hash; sub hash_alias_4 { my ($hash,@k) = @_; tie my %x, 'Tie::Subset::Hash', $hash, \@k; return \%x; }

Earlier you said:

@_ ... seems to be reliable. Though not many people know if it depends on an implementation detail.

I've included a test in the above distribution that tests it. So it'll be run on CPAN Testers and now we have a canary to see if one of the newer releases of Perl starts breaking the aliasing via \@_ :-)


In reply to Re^8: 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.