dinesh has asked for the wisdom of the Perl Monks concerning the following question:
{key1=>arrayindexvalue1, key2=>arrayindexvalue2,..... }
for example
now this will work both as an array and a hash$arrayreference = [{first =>1,second =>2 } , "hello ","there"];
can i build this thype of array at runtime that is can i add elements to this array one by one rather than initializing them all at one timeprint " $arrayreference->{first} \t $arrayreference->{second} \n"; >hello there print " $arrayreference->[1] \t $arrayreference->[2] \n"; >hello there
thanks
dinesh
edited: Mon Jul 1 13:29:48 2002 by jeffa - added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: making arrays that act like hashes at runtime
by davorg (Chancellor) on Jul 01, 2002 at 11:55 UTC | |
|
Re: making arrays that act like hashes at runtime
by cjf (Parson) on Jul 01, 2002 at 12:08 UTC | |
|
Re: making arrays that act like hashes at runtime
by amphiplex (Monk) on Jul 01, 2002 at 12:07 UTC | |
|
Re: making arrays that act like hashes at runtime
by perrin (Chancellor) on Jul 01, 2002 at 13:45 UTC | |
|
Re: making arrays that act like hashes at runtime
by bronto (Priest) on Jul 01, 2002 at 13:51 UTC | |
|
Re: making arrays that act like hashes at runtime
by Sifmole (Chaplain) on Jul 01, 2002 at 11:28 UTC | |
by particle (Vicar) on Jul 01, 2002 at 11:50 UTC |