in reply to Writing an array inside an array
You probably don't want to assing [] to @sub - that way the array doesn't become empty, but holds a single value, which is a reference to an empty array. Use @sub = () instead.
Also you'll probably want $graph[$i] = \@sub (no my before it. You're assigning to a part of an existing data structure, declaring a new variable doesn't make sense in that context).
Also please read perllol, which talks about arrays of array references.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing an array inside an array
by talha099 (Initiate) on Nov 18, 2010 at 13:03 UTC | |
by MishaMoose (Scribe) on Nov 18, 2010 at 13:17 UTC | |
by talha099 (Initiate) on Nov 18, 2010 at 13:24 UTC | |
by moritz (Cardinal) on Nov 18, 2010 at 13:33 UTC | |
by talha099 (Initiate) on Nov 18, 2010 at 13:44 UTC | |
| |
by raybies (Chaplain) on Nov 18, 2010 at 13:50 UTC | |
by moritz (Cardinal) on Nov 18, 2010 at 13:11 UTC |