Perl Monk, Perl Meditation | |
PerlMonks |
Re: Simple file to arrayby waxmop (Beadle) |
on Jul 08, 2002 at 20:30 UTC ( [id://180311]=note: print w/replies, xml ) | Need Help?? |
write the file with addresses like so:
then to load this into 2 arrays ( 1 for names, 1 for email addresses) do something like this:
and now you've got 2 arrays: @names has the names, and @addresses has the addresses. They are indexed by the same number, so joey's name is stored at
and his address is stored at $addresses[0] another exciting way to do this would be to use a hash.
Now, to get joey's address, just do this:
In Section
Seekers of Perl Wisdom
|
|