in reply to how to alias a subset of an array

#!/usr/bin/perl use strict; use warnings; use Data::Alias; use Data::Dump qw[dd]; my @A = (1,2,3,4,5,7,21,55,66); dd @A; alias my @B = @A[2..4]; dd @B; $B[0] = 0; dd @B; dd @A;
output:
+% ~/test/alias.pl (1, 2, 3, 4, 5, 7, 21, 55, 66) (3, 4, 5) (0, 4, 5) (1, 2, 0, 4, 5, 7, 21, 55, 66)

Replies are listed 'Best First'.
Re^2: how to alias a subset of an array
by ww (Archbishop) on Oct 26, 2010 at 00:41 UTC

    And for those w32-ites (-ers ?) searching for Data::Alias using ppm; so sorry, not yet, AFAIK.

    But it is, of course on CPAN, or -- as an alternative, this piece of the code therein, for this particular evolution, appears to work when cast as a sub, like so:

    sub alias { use base 'Exporter'; use base 'DynaLoader'; our @EXPORT = qw(alias); our @EXPORT_OK = qw(alias copy deref); our %EXPORT_TAGS = (all => \@EXPORT_OK); pop our @ISA; }

    and called like so: alias(@B);

    which highlights another of my many blindspots! Can someone enlighten me as to how much more of the 400+ line source (mostly POD) can be eliminated or sidestepped? I've read and understood jwkrahn's solution (below) but reading the docs for D::A, Exporter, Dynaloader left me about as clueless as when I began.

    Or is the joke on me because I missed the joke?

      And for those w32-ites (-ers ?)

      ppm install MinGW cpanp i Data::Alias