Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 taking refuge in the Monastery: (4)
As of 2014-11-24 04:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (135 votes), past polls