You should be able to achieve this with Data::Alias. I can't test it, due to my need to stick with perl 5.8.8 on win32--sigh.
use Data::Alias; use Data::Dumper; my @foo = qw( A T T G C ); alias my @view = @foo[1,2]; $view[0] = 'x'; print Dumper \@foo;
TGI says moo
In reply to Re: a referencable array slice (so assigning to it modifes the original)
by TGI
in thread a referencable array slice (so assigning to it modifes the original)
by muenalan@cpan.org
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |