in reply to subroutine - Passing Array Reference by Reference
This will pass a reference to a new copy of the original reference's data ("sub" is a really bad name for a sub, so I'll call it "stub"):
That only copies down one level, so if $arrayRef is an AoA or something you'll need to adapt a deeper copy for true isolation;stub([@{$arrayRef}]);
for an AoA, orstub([map {[@$_]} @$arrayRef]);
for an AoH, for instance.stub([map {{%$_}} @$arrayRef]);
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: subroutine - Passing Array Reference by Reference
by awohld (Hermit) on Oct 30, 2005 at 04:24 UTC | |
by friedo (Prior) on Oct 30, 2005 at 04:44 UTC | |
by chas (Priest) on Oct 30, 2005 at 04:48 UTC |