http://www.perlmonks.org?node_id=229110


in reply to Re^2: Non-destructive array processing
in thread Non-destructive array processing

But what will simply alias the lexical @array with the dynamical @array. So I don't see what you've achieved by doing this.

One problem with this that you probably didn't foresee is that lexicals are resolved before dynamic variables. Example:

my @foo = 1..4; local *foo = ['a'..'d']; print @foo; # 1234
The problem is solved through our() since that creates an aliased lexical:
my @foo = 1..4; our @foo = 'a'..'d'; print @foo; # abcd

ihb