Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: Help with arrays

by Anonymous Monk
on Sep 22, 2012 at 05:06 UTC ( #995040=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Help with arrays
in thread Help with arrays

Perl will handle array size (memory) as needed while populating an array. The "unknown length" part becomes crucial when you have to know the number of array elements beforehand if you were to write a C, C++, or Java program to fill an array. (In latter two languages there are other data structures -- vector, set, etc. -- to avoid the need to know the number of elements beforehand).

An exercise of an array of "unknown length" would be to populate an array from a file of unknown lines (thus number of array elements) with each number listed on a line by itself.


Comment on Re^4: Help with arrays
Re^5: Help with arrays
by Anonymous Monk on Sep 22, 2012 at 07:26 UTC

    "An exercise of an array of "unknown length" would be to populate ..." -- self.

    That was rather sloppy, which should have been "A related exercise would be to populate ..." (among other variations).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995040]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-09-21 01:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (165 votes), past polls