in reply to Re: Trying to understand aliasing (*var)
in thread Trying to understand aliasing (*var)
they will be removed completely in Perl6". So that might be a reason to avoid this particular type of magic,...
By that token, you should also avoid $array[ 1 ] = 2;, because that won't work in p6 either.
Nor will $hash{fred}=27;.
Nor will do { n++; } while $n < 10;.
Nor will print ( 'Hello, world!" );.
Nor will while( <DATA> ) { my @array = split'\t'' };.
Nor will keys %hash = 1000;.
Nor will for( my i=0; $i < @array; i++ ) {...};
Nor will $#array = 1_000_000;.
Read more... (357kB)
Nor will open FILE, '<', 'myfile' or die $!;.
But then again, local *array = \$arrayRef; won't be needed, because the syntax for
my @array; push @array, $somevalue;
And
my $array = []; push @array, $someValue;
Will be the same...or so it was at some point in time.
So, whilst P5 doesn't provide an alternative to the simplicity of
local *array = $aRef; push @array, $someValue;
it is a very useful construct to know.
|
|---|