dinesh has asked for the wisdom of the Perl Monks concerning the following question:
hi
i want to know wheather we can build an array which will acta s an hash at runtime
it is possible otherwise in versions 5.005 and above
using the syntax
{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
Back to
Seekers of Perl Wisdom