By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,179 Members | 970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,179 IT Pros & Developers. It's quick & easy.

How to dynamically initialize an array

P: 35
I would like to have an array, its size will be passed as an argument in runtime. And I want to intialize it. How should I do? Thanks.
Oct 21 '08 #1
Share this Question
Share on Google+
2 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
Ok, so what have you tried thus far to do this? This sounds distinctly like school work. If it is, then you need to know that it is against this sites posting guidelines for you to post your homework and expect an answer.

What you are asking is rather fundamental and a quick Google search will help you do what you are asking. Any good "perl arrays" tutorial should explain these basic concepts.

Regards,

Jeff
Oct 21 '08 #2

KevinADC
Expert 2.5K+
P: 4,059
I would like to have an array, its size will be passed as an argument in runtime. And I want to intialize it. How should I do? Thanks.
You don't have to allocate memory/buckets to arrays in perl if thats what you are thinking. Perl dynamically adds more buckets as needed and when needed. There might be special reasons to allocate some memory to an array before actually adding data into the array, but I don't know what those reasons might be.
Oct 21 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.