Great Thomas Ur idea has resolved my issue.. i finally solved it after struggling from 16 hours.
:) Chaitanya On Wed, Jun 30, 2010 at 12:07 PM, Thomas Bätzler <t.baetz...@bringe.com>wrote: > Chaitanya Yanamadala <dr.virus.in...@gmail.com> asked: > > i am in a situation like i have a scalar $value = 5 > > now i need to create an array with the number i mean $value > > how can i do it?? > > Don't even think about messing with the symbol table, use a hash variable > instead: > > my %hash; > > my @array = qw(foo baz bar); > > my $value = 5; > > # store reference to an array in the hash element $key > $hash{ $value } = \...@array; > > $hash{ 7 } = [ 'eni', 'miney', 'moo' ]; > > # accessing data, e.g. 1st Element in array "5". > print $hash{ 5 }->[0]; > > Using a hash makes sure there are no unwanted side effects like you > accidentally overwriting some variable required elsewhere. > > If you gave a better description of what you wanted to achieve - as opposed > to what you think you need to do - I'm sure people here would be able to > help you better. > > HTH, > Thomas >