Important alert: (current site time 7/15/2013 9:05:28 PM EDT)
 

article

Declare/create a structure

Email
Submitted on: 7/29/2000 10:42:37 PM
By: Found on the World Wide Web 
Level: Beginner
User Rating: By 2 Users
Compatibility: 5.0 (all versions), 4.0 (all versions)
Views: 7102
 
     How do I declare/create a structure?

 
				

In general, you don't ``declare'' a structure. Just use a (probably anonymous) hash reference. See the perlref manpage and the perldsc manpage for details. Here's an example:

 

$person = {};# new anonymous hash
$person->{AGE} = 24;# set field AGE to 24
$person->{NAME} = "Nat";# set field NAME to "Nat"

If you're looking for something a bit more rigorous, try the perltoot manpage.


Other 100 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.