in reply to Re^3: a referencable array slice (so assigning to it modifes the original)
in thread a referencable array slice (so assigning to it modifes the original)
I am not sure if an alias is something you can push and pop on thing ? So how to modify a @view once its there ?use strict; use warnings; use Data::Alias; use Data::Dumper; my @foo = qw( A T T G C T T G C T T C ); alias my @view = ( @foo[1,2], @foo[5,6] ); map {$_='x'} @view; print Dumper \@foo; alias my @subview = ( @foo[7,8] ); push @view, @subview; map {$_='$'} @view; print Dumper \@foo; print "nok" if $foo[7] ne '$';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: a referencable array slice (so assigning to it modifes the original)
by TGI (Parson) on Jun 18, 2008 at 20:53 UTC |